From patchwork Wed Mar 2 09:43:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ley Foon Tan X-Patchwork-Id: 8479771 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@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 65D079F2F0 for ; Wed, 2 Mar 2016 10:15:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EE5552035E for ; Wed, 2 Mar 2016 10:15:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B0D3B20295 for ; Wed, 2 Mar 2016 10:15:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753337AbcCBKPN (ORCPT ); Wed, 2 Mar 2016 05:15:13 -0500 Received: from mail-by2on0071.outbound.protection.outlook.com ([207.46.100.71]:60562 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753332AbcCBKPJ (ORCPT ); Wed, 2 Mar 2016 05:15:09 -0500 X-Greylist: delayed 1051 seconds by postgrey-1.27 at vger.kernel.org; Wed, 02 Mar 2016 05:15:09 EST DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=altera.onmicrosoft.com; s=selector1-altera-com; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=Nyu39cMn80wxY0k/uo+jiMLFAV2xWigol6pA8vPVhlY=; b=KU5l0hrhUInO7YYDA6y6CYC9MnP5uYQi602oEsEdXLh4Gimg311wADSHKNngNIjarG/GqZ8yVRiJF+5lQwhb0OlR4F7qjSozChBkoa2LsPv0aGmdPRsKKWNkejwNNAuRC5jEYa8CX2lCwNhiDqudrvmokmSpXo/2iqtB/0P5g8E= Received: from BN3PR0301CA0032.namprd03.prod.outlook.com (10.160.180.170) by SN1PR0301MB2030.namprd03.prod.outlook.com (10.163.226.28) with Microsoft SMTP Server (TLS) id 15.1.427.16; Wed, 2 Mar 2016 09:43:14 +0000 Received: from BN1BFFO11FD051.protection.gbl (2a01:111:f400:7c10::1:182) by BN3PR0301CA0032.outlook.office365.com (2a01:111:e400:4000::42) with Microsoft SMTP Server (TLS) id 15.1.415.20 via Frontend Transport; Wed, 2 Mar 2016 09:43:14 +0000 Authentication-Results: spf=softfail (sender IP is 66.35.236.227) smtp.mailfrom=altera.com; vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=altera.com; Received-SPF: SoftFail (protection.outlook.com: domain of transitioning altera.com discourages use of 66.35.236.227 as permitted sender) Received: from sj-itexedge03.altera.priv.altera.com (66.35.236.227) by BN1BFFO11FD051.mail.protection.outlook.com (10.58.145.6) with Microsoft SMTP Server (TLS) id 15.1.422.5 via Frontend Transport; Wed, 2 Mar 2016 09:43:13 +0000 Received: from sj-mail01.altera.com (137.57.1.6) by webmail.altera.com (66.35.236.227) with Microsoft SMTP Server (TLS) id 14.3.174.1; Wed, 2 Mar 2016 01:41:44 -0800 Received: from ubuntu (pg-lftan-440b.altera.priv.altera.com [137.57.162.5]) by sj-mail01.altera.com (8.13.7+Sun/8.13.7) with SMTP id u229h9DY027966; Wed, 2 Mar 2016 01:43:09 -0800 (PST) Received: by ubuntu (sSMTP sendmail emulation); Wed, 02 Mar 2016 17:43:08 +0800 From: Ley Foon Tan To: Bjorn Helgaas CC: , , Ley Foon Tan , Ley Foon Tan Subject: [PATCH] PCI: altera: fix altera_pcie_link_is_up() Date: Wed, 2 Mar 2016 17:43:07 +0800 Message-ID: <1456911787-3576-1-git-send-email-lftan@altera.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CPI:66.35.236.227; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(199003)(189002)(36756003)(229853001)(50226001)(5003940100001)(47776003)(50986999)(105596002)(106466001)(92566002)(81156009)(48376002)(189998001)(5001960100004)(42186005)(11100500001)(107886002)(2906002)(5008740100001)(110136002)(6806005)(33646002)(586003)(50466002)(1096002)(1220700001)(86362001)(19580405001)(87936001)(19580395003)(4001430100002)(7099028); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR0301MB2030; H:sj-itexedge03.altera.priv.altera.com; FPR:; SPF:SoftFail; MLV:sfv; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD051; 1:5ZX6QijlcLJ+69yjy57Nginy3Noxcueu1tl79J7I3LIGBHc3Stn7YV1WW7/1/JJDzDctuB6fwzGcF2Wq0oW/0bnd/pEL8d1XZG6QHpGwS+mgIjDpqCgYCmCNjkw/15K4ogjlNioH7U78nGW8MJ7Bk1zfCRRAZX7999hmGXEdkgdlF+EXLmBUIRACvVDmGMRaT58mtQd0SfO8tHyghMN4qFkXcjvAFdnbmDM2gkchzSTjIRgGbKww1DwXa9nlHyKAKEH74cKz6P2OVmha+8XdmRLKDWZh3R+0B1xEGWrD8GlZxj38N9/ayFV9FED+OqSRbltmYxFM83L21Z6ughS94chx9PJgAFaW7fQf5+Qu14ZUxWelOxLYxePVFqQDevbSL5BB2MIPd9ASQuSY8pzMRglHfBoQx8t+vDwPpI8CT+tiR0mCTDE/pdjyEMcm1/fEn8AyMsoSqhPt9xaX5UhvAA== X-MS-Office365-Filtering-Correlation-Id: 5969e32f-6e01-4e62-6926-08d3427f1331 X-Microsoft-Exchange-Diagnostics: 1; SN1PR0301MB2030; 2:QSB3V0qAz/Vq7+HOHEFg4NT4Xmxj7fOrZB40SOvMxX2O6h2eJGBcbh/GvkOT5X/92/VBzvhJiwuF8Obzf4iLqGfoPFfU6qXHIKv172qUnDFq4BW3WtGQomb4XU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+Ec5fR4xKQyYA2i+z1wNQ1n2wIQnoqoBh/PCHGN6F18rZJxuxy1dggJ4JDOfbjFPJ9LjAA4uUgcpiQt6hmkXR/1EmdN5nQCMhEhoE2DHl95LO5g5So5zIWhBQvK5Df9NKuDB6r9KFX73hNHRI45m72TeRnEZSJEjwiQBEcugyOFAYv9FBAxWRe6Q0XQW8BXW2NR11t955GnjCEoubejuXwITHCas3IJrGKKZ9+1wSGXPyxZniO4mtksWPjbKiT49SOsO5L7BdCdJU8u9dEbB2mwNydRyqDRmgmImCeB0f5OGIHhy9fJGHMwmHselPld2IJjFwMjxSCMYlV2RIQNpmOA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13015025)(13017025)(13023025)(13024025)(5005006)(8121501046)(13018025)(3002001)(10201501046); SRVR:SN1PR0301MB2030; BCL:0; PCL:0; RULEID:; SRVR:SN1PR0301MB2030; X-Forefront-PRVS: 086943A159 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR0301MB2030; 23:au1i2IttoUmQygpjPN9ptdsaZ9C5kCHrdGGA6HP?= =?us-ascii?Q?McUi6zN4ZXx1vwjKAs/Dvti4XVqjqW5a01nUT+lzhzogRvt9LQNoDHbLp3Qh?= =?us-ascii?Q?bsP/3uNHBrZRW8tisl6bUin06RGuzeYaYX6oneCIDYuc9MOshujAygxlOjg0?= =?us-ascii?Q?iOTYkx1ZtFfNFUrE6foa6VtyFzMWTbz9kRjNKgqo2+ikiWgx39KZA7BHIVK4?= =?us-ascii?Q?WaFJbyu5JJYuLsxMHkVPEn+jknmWejcHd5EPVgSbagrY/GtrQElvBf28XKL8?= =?us-ascii?Q?tvmoegVHkAAIGYKXa+r1yL8Jy96SD6QxDuOsN5Cj5u9vE4KQcvsif9FQZnMy?= =?us-ascii?Q?xHhze34FFbi2drP8lbH88TsgmB0kRPFa/OyOTJ81vb9o1e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qa4PTLkd8nQGH2PaG5nYY9FxB6NKCY29E9ncQLJ5TzmhiaBX7uhIbLsRp/yywT8HnthpFBw/va8j612eXJKnZEU9WPE2Q5uNJ07fdx1PhKEF9+vJaGSdIqKlhheq0BS1WhRnOzzw03qeulwI8qQK91U5RsE= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: altera.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2016 09:43:13.6225 (UTC) X-MS-Exchange-CrossTenant-Id: fbd72e03-d4a5-4110-adce-614d51f2077a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=fbd72e03-d4a5-4110-adce-614d51f2077a; Ip=[66.35.236.227]; Helo=[sj-itexedge03.altera.priv.altera.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR0301MB2030 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,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 The original code return true if RP_LTSSM register return non-zero value. This fix to return true only RP_LTSSM register is in L0 state (link up). Signed-off-by: Ley Foon Tan --- drivers/pci/host/pcie-altera.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/pci/host/pcie-altera.c b/drivers/pci/host/pcie-altera.c index 99da549..dbac6fb 100644 --- a/drivers/pci/host/pcie-altera.c +++ b/drivers/pci/host/pcie-altera.c @@ -40,6 +40,7 @@ #define P2A_INT_ENABLE 0x3070 #define P2A_INT_ENA_ALL 0xf #define RP_LTSSM 0x3c64 +#define RP_LTSSM_MASK 0x1f #define LTSSM_L0 0xf /* TLP configuration type 0 and 1 */ @@ -140,7 +141,7 @@ static void tlp_write_tx(struct altera_pcie *pcie, static bool altera_pcie_link_is_up(struct altera_pcie *pcie) { - return !!(cra_readl(pcie, RP_LTSSM) & LTSSM_L0); + return !!((cra_readl(pcie, RP_LTSSM) & RP_LTSSM_MASK) == LTSSM_L0); } static bool altera_pcie_valid_config(struct altera_pcie *pcie,