From patchwork Wed Jul 19 15:57:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13319158 X-Patchwork-Delegate: kw@linux.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61387C001B0 for ; Wed, 19 Jul 2023 15:57:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231154AbjGSP5f (ORCPT ); Wed, 19 Jul 2023 11:57:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229681AbjGSP5e (ORCPT ); Wed, 19 Jul 2023 11:57:34 -0400 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2080.outbound.protection.outlook.com [40.107.20.80]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8B5D197; Wed, 19 Jul 2023 08:57:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K20IQ9OqILpM+lerGEHXe3LirMemcpnaWZPYcPVmRErItHHTCIUencA1B/K03FX7wfQYPbyJh6GVwyloBDJ7xOSXWj3GM1BP2lcHcfIELkqR98+MEGpsCSS5jpzTYLM43FXb8N6wzmFWKBd8Fq4tXaP753/PVD89V6xsSvLKY8EqmlLEmEOFVw09MNauiG2NWtuV3WUpJaokTjNc9oyDn/nFKc/N8MxfEOxPkUB4fAB6AKmCH7O7nsdYzMRICSNFak2lT1lPf4nH3xA6SAtnf0fsRhNIGKSuVeFtVWM8CG5sGl9WlcaahAuN1aMSDxzm6Dys873vkjjs1jvsM9A7Tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ZycBneTbgXkUljC+nErl4NsfVXu1LOODZM00tD9/H3I=; b=DIAEtOwSCvc2VMskPOKMjH3mXco36rsemS9OEmGq36cns5sTK19H2jzFro7tU9/6OFxM0prWVJXmjpVOlPSegRHSJ/S5qe9xJRxpRwg0yiEH5EYaGhTwvT0rLgOmd/8bIsEwyo9I7Hz5REXUGrX9o8ffLGfG4AQwEQA6XjvNwC7L/c2nFIzVxPps/ucYHl0VeBvOWVmzXONgbXJFXF+1/v5sllQLtZzsOGhEEx1Mf2pXNMH4B47Ly9brQV8JxNgdOn5RhunNqqxt9wO0fqHfGZZUqzVllpm4mSMQaTZ8qS1Ar052W0h44O4UKHN+4sWNDShrghx+AeRBu3x1PNdiiw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZycBneTbgXkUljC+nErl4NsfVXu1LOODZM00tD9/H3I=; b=bWSV0DA90r60pHAE2Lxr6aWssvwsEQR/5rDX/1ORupg3oLK6HEVgcqVRcGay/H3vD2eIUJWkqrm1FK1yhXCMPqHNxm8L5rwSNinUG+6c7QEr0Xd3zeO82YIhT+zuKXDsH9/1w0aSRowjWlTbLL5sub9A6fCOsWbDhKvBlZICpm8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by DBAPR04MB7399.eurprd04.prod.outlook.com (2603:10a6:10:1a8::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.33; Wed, 19 Jul 2023 15:57:30 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::d0d5:3604:98da:20b1]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::d0d5:3604:98da:20b1%7]) with mapi id 15.20.6609.024; Wed, 19 Jul 2023 15:57:30 +0000 From: Frank Li To: markus.elfring@web.de, lpieralisi@kernel.org Cc: Frank.Li@nxp.com, Zhiqiang.Hou@nxp.com, bhelgaas@google.com, imx@lists.linux.dev, kernel-janitors@vger.kernel.org, kw@linux.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, mani@kernel.org, minghuan.Lian@nxp.com, mingkai.hu@nxp.com, robh@kernel.org, roy.zang@nxp.com, xiaowei.bao@nxp.com Subject: [PATCH v3 1/2] PCI: layerscape: Add support for Link down notification Date: Wed, 19 Jul 2023 11:57:06 -0400 Message-Id: <20230719155707.1948698-1-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SJ0PR03CA0137.namprd03.prod.outlook.com (2603:10b6:a03:33c::22) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|DBAPR04MB7399:EE_ X-MS-Office365-Filtering-Correlation-Id: a1732285-a8af-43f1-ed96-08db8870db41 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0fndd5lTac0My0bzYhTUuaxRneajdGgO5aAq90P4g/+lzZE/tw1uxeDNNooRBjh1wkRYRBlzUb9xyOp8tT3Zn2rY4xbhPWgXQKZjrpxwh1c0Y0q9/BmV+lLYMhAQv4iMu2dX4c1E90PizOcH3oANKeO/vZffVx48zMAxQ7mHFd48+FfOQf82CIMGS0W5Gzlz3m3pQ13A7N8qgAAUZSi6bqhuZRAl/ViFHO7jRSHAr9IIpGZYtxsoVGqooCMGiOt3QDTWPpfgk98SDd0dTgLsxl2ETi7wAV/yVJtww1udbkcTwyzjXirerSkgb+En1e0YdhceVtPSpAN/RdF1dI3VYuwXy59OdxKHLaKKWtoy9VxXu7niuNYvoI7Ba9Zk6GNBt2i3A4oTJKx0j2KEkGOvGipkKIhP8cfHKmc4FpdMUbCpvyif1vSUh7nr2mrQVGLjoxBTmX4194+mCDK/M/uwy/RLFLNCt7Bn5IfKfod3wi0mCirnd21NHmrFpmWeOOjSqwVHn2863eA4snztRqa6cJjfW8IKYb2Uix6UPST+AYOuksnBcqaaTDdBoW8KU1lnS/xbTnu2rWL/i10lDId428sJ+dsESkgg2ObWYIBveFEC6Tw4J2aS8Cy1AblWmKsk X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB4838.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(346002)(366004)(39860400002)(136003)(376002)(396003)(451199021)(6512007)(6506007)(1076003)(15650500001)(36756003)(38350700002)(8936002)(7416002)(5660300002)(8676002)(86362001)(4326008)(2906002)(4744005)(316002)(66476007)(66556008)(41300700001)(66946007)(6486002)(26005)(38100700002)(6666004)(478600001)(186003)(2616005)(52116002)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: K4zVk2G1aWv+l9SAEUXvXaxgAIt1Bfc2tds50A3+FYEcZwww9THMG/sMyQL42oDFdn38CtjaKXPAhNAcxvB+tyO7VSumSMR9HmkDzBuqYJwWopYMJZfWH239gagQ7Hev+c8PqMz1l9+oP9mrHyrQ9M7cUWpCFKygFJMmQ+60Qr8oHNixN/x2vSqYmG7jDD91cGobhN6IVyhB1oJqFGpeXVpXiLJYhlhiOLCGR9Xyy/At91C5r2T8ASI4hrHkJPAoVZU+6UfYqjCn1dwlDtm5e064FTF8JdGwCeJ04ZrM8aTBTFBnwsVab/qM/NDrrCl6mlZoNStKYx/SFJS81LMel+jTwhLlOk66IqOWauYT9HhB5p6zjxXPqY6PzN+P5myJXO9CQGQGnoaMhq5woRegqCCMu8psrwhxFeylpxOL/YjEbzGjbSIBuKYeNq2ZD/VksxQ+XBE/uSfxw1duSM4OyYMmrbHWmK9Omuq3U5CqTkCYKBW9TlCvNelPuxioxGc3XOudfLWjbnvSOyUitNQNR1pa80MwOlVhK1qwCBaJjSBTBofzpAm80yWzxzkYkCCCHYbDaLEoKqpAda8fmf2JwTGgBUZf3EE0365WyOlfqAoY2svu4wKuY5Fk6URykZaNGM804We6IQbGBVj8398s2X7PjjYcnu85GTrJ45vxaEnHQlAsqpJjVqA0IJhxAXm0yLYqWlx8j3noKVPY20S8apJFGvS/8Cu7yiglz+hdjVcOpnmBdibTx2cfxnZ+H7H1UEATBxMFaRpiCfvEqCbCZTDtkRuRUZHKocJKYSeLzgmLvhu9sKGt2Xi9D7EMggwNay9huT/m3PIr9ysiOXOD0jxAEfxt+J+aXUbw79Eo9gdzNX3tQ2i8PDlTJ4SRme72FcxuBNIDeDX/ZQbb1pUWN6B7if0mH5bHiCcu/MYgx8xX7JBLwdWMZMupd44fTR95aTEj/9ApOMkWxeyfTFeetwdANKAcx0MCfpCQMABlb0hsMcyzOby8VL8XPGWVbSrBQ1Jd2IaeDG7xPKCC7rrqJ5RNnlMdqYQsjRkIlcVlEv338EqEuMkWvhHRCKEyYHdyLScNKPHmEqOmZcuoP1BfjwLzQrSUe95dAb14TpSqdydAkmvRaL/2kfBq0oMh9A/bxS6nVLH1T/jDpHC36TmBFuepGkupYxSMVqELgs8Ks8bGEylrIlf3BF+CtfTSqszbh949T01T1NrvlpBXKuv+6C42ILV3hTaSJXHFQvKhgPxGlYPfk+iv+aH6fdCmvAu1ENBOVVrVNKooA3crHdA9AR7C/Cmy70EREBrX6mrvBKtYK7t/V8HRG9ZlYWne0/wz+VSp34REUE3rDe1SwbewrNpoxolZaOfpXCS1crZx+h7Gx3Yed0RmJ+22tdPjLVvy67aELGt2yKCadGknFnsVGecnTpiGVNkVhVEkm057NTyQ2gdikPmUU/1SgfNUu+heWt0rZ7rDeYcNi4UeD+d2HhjDKdCMVHYgJjLMA1xYOoJLPqrMZFg4jwT/ltw1hpP27tK1RGxLizpsSnVuBtESphzewJmdqLPdvFFGdIuTcOs= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a1732285-a8af-43f1-ed96-08db8870db41 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2023 15:57:30.2901 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: O6ZNVRKNXJDfG7oPXRy4rOAfNGoqlITx4Vb42vEnmKq29fOF/UMkvMTWrtNbkGNKod74+jfRImUGjRm+pT6bAA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR04MB7399 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Add support to pass Link down notification to Endpoint function driver so that the LINK_DOWN event can be processed by the function. Acked-by: Manivannan Sadhasivam Signed-off-by: Frank Li --- Change from v2 to v3 - none Change from v1 to v2 - move pci_epc_linkdown() after dev_dbg() drivers/pci/controller/dwc/pci-layerscape-ep.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/pci/controller/dwc/pci-layerscape-ep.c b/drivers/pci/controller/dwc/pci-layerscape-ep.c index de4c1758a6c3..e0969ff2ddf7 100644 --- a/drivers/pci/controller/dwc/pci-layerscape-ep.c +++ b/drivers/pci/controller/dwc/pci-layerscape-ep.c @@ -89,6 +89,7 @@ static irqreturn_t ls_pcie_ep_event_handler(int irq, void *dev_id) dev_dbg(pci->dev, "Link up\n"); } else if (val & PEX_PF0_PME_MES_DR_LDD) { dev_dbg(pci->dev, "Link down\n"); + pci_epc_linkdown(pci->ep.epc); } else if (val & PEX_PF0_PME_MES_DR_HRD) { dev_dbg(pci->dev, "Hot reset\n"); } From patchwork Wed Jul 19 15:57:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13319159 X-Patchwork-Delegate: kw@linux.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 465BDC001B0 for ; Wed, 19 Jul 2023 15:57:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231472AbjGSP5m (ORCPT ); Wed, 19 Jul 2023 11:57:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231840AbjGSP5j (ORCPT ); Wed, 19 Jul 2023 11:57:39 -0400 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2058.outbound.protection.outlook.com [40.107.20.58]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E20CE47; Wed, 19 Jul 2023 08:57:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lT6elCoTotyP1e+HRuVVarguQ9zQARKS71DPCS9ksmsAUZ27vyxhFugxR6j9JYkGGnmSniG8mghGBu6sqJvo93IAR5WQFAdufJzO07VLvwEqnJ12K52Ms6xJtZgl2nHSCcSadR5rkyjmWTUEb5ng/1jdd12eh0WWPZtEHgM1dymUUK3+BcLotFtP3JV9HspxJThV4mXUrIeBYuGj6y5I0oFbTTvDtv4PCoPB1SAV6XNIJC1pDfBXkO6/mP+q6dNNlPhQpDJyYaZuA4GTcwbrkwzQKA2+nE7I3QhAoyU7qP0hW/6GlsfUzebfUpuoEz41H6SisVU9cHEY2qdX0JPpnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=I6Daic+IBKy143NJIvPCR9+fRCcKKLeKW9qtvvZfZkI=; b=TKsqtr+yrxr4o+yOy/sIT+ki1DFTpzO5HCD2tvbuzY2dHZ8Qvs4b7oPNrzREJ1p84vtIRZYX6vbax9Bd8Pi9y2iPWyRd/P6uQ/p2AVu07WIsnPB1QKatyiFJhTQ6t270YwMl1ACxoxL2oCPHU57L29IYInVa0TVaS6ymKLOi7Gr+do7p+epUojVXkvlvncxPQB9Nm2VXLDXXPR6ViMkgj8B0WJabq+4cFt2MFzKSfkjQtIYugqv7Ga2MQ8YXvqdID4csEytDcmwlvkrnWrLpGCcB5ie8x9osMyuVtezHcyGymeo+waqtnjNyguDUmmHSPazHnfd+jGJ1GxSv7n/hdw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=I6Daic+IBKy143NJIvPCR9+fRCcKKLeKW9qtvvZfZkI=; b=JoPnAxxhpoWf42+BSmHij25c3DyG65uzMLf6dYmXnlVf5lBt6mJjFBfv5BVXlfHd8g5sl7r/5/lBLYHqADG7NfT9OSudZJIiE6i07xvJq4JG1MOI8AIoNH8xb9l5xiHXsLBveJW7q1OVCHbxwknx71ceZJ6IEa0uPrNwQoJd0os= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by DBAPR04MB7399.eurprd04.prod.outlook.com (2603:10a6:10:1a8::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.33; Wed, 19 Jul 2023 15:57:36 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::d0d5:3604:98da:20b1]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::d0d5:3604:98da:20b1%7]) with mapi id 15.20.6609.024; Wed, 19 Jul 2023 15:57:35 +0000 From: Frank Li To: markus.elfring@web.de, lpieralisi@kernel.org Cc: Frank.Li@nxp.com, Zhiqiang.Hou@nxp.com, bhelgaas@google.com, imx@lists.linux.dev, kernel-janitors@vger.kernel.org, kw@linux.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, mani@kernel.org, minghuan.Lian@nxp.com, mingkai.hu@nxp.com, robh@kernel.org, roy.zang@nxp.com, xiaowei.bao@nxp.com Subject: [PATCH v3 2/2] PCI: layerscape: Add the workaround for lost link capabilities during reset. Date: Wed, 19 Jul 2023 11:57:07 -0400 Message-Id: <20230719155707.1948698-2-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230719155707.1948698-1-Frank.Li@nxp.com> References: <20230719155707.1948698-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0137.namprd03.prod.outlook.com (2603:10b6:a03:33c::22) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|DBAPR04MB7399:EE_ X-MS-Office365-Filtering-Correlation-Id: 727afc9a-fdde-42f9-bdd3-08db8870de29 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EL3EGK4fpdxPteGAtKYr2+SrnEHOujCY/JWDp63Aeihz5Hjjgqg8S5uhCXxLQnrPORYJlDxYcvJPoEHfz+0fbEi0NJU8uSCxEAEbCkqSjUWS2+qTewcvqlqy9H7NTJXRx6DoH2ZmsaHDSfSPfzIKqN6gYMe2H6O8YcrcDu5URE2zIbVDeZfwoKj3BMOPhmPJIMYbBl5CJEXVV1xbcJq3LU4UHBOU8AZJm56ltzampAF4FDu3IM2AQ1EQyDb3C3skc8zI2aQ37NyeXV0YXOUA1CTK7vw8kpGtdhmqMENHyeN+pzL+4ieOycdNAv6HH4CXm1cNPchX8DSPe4Qb7u63FhVnCCZzfKKkE01+/mF6SBcjr5Lk/jouAFDKKQVf85rXWyNOWKsidvDsLI5xB7rZ4jqpUqvanDci2F5P8QPBPn8niBCmZXt0RlNhrJvyTbE+48wG2hHN91CFymcpbLLdtvE1wSsIoG2z2XvEQQ6Idf9RrDLCqsfewTMYdW8w46CcVDrCtiS4zKjS7p8exMVYMm/MdI77CuEdAm2tGPt7RhflHjB3whPxdXxWgygw7TRoHBQTDpJfQMxeMTlbgsjAwzwGCIIZrKaahLdCOQ8jwdJ90bXaMRDAmfhOBiarbKkD X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB4838.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(346002)(366004)(39860400002)(136003)(376002)(396003)(451199021)(6512007)(6506007)(1076003)(36756003)(38350700002)(8936002)(7416002)(5660300002)(8676002)(86362001)(4326008)(2906002)(316002)(66476007)(66556008)(41300700001)(66946007)(6486002)(26005)(38100700002)(6666004)(478600001)(186003)(2616005)(52116002)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: r2sbUlG3+ypTowdRX4/MwQNZusNjUEWe+qhouJUq1X4J8TDHOVEatqth8EPewVhC3vs66YZgcxKtD2KfXPDGqIrlcSRuDtrIS0MKSafzzLUHB45suUZM6ryQEvGQuEJnHJMafuFpht8R8t2lPnbj0wHUXRPKxHd6CCHDVavExn08dEQzw8hP3AHV5XWm20jwpaQRTUsZKElaLX8xfiuTbTv4DuK/79MEvX7qHYAIJsUNDwZ4zfdcHEUnzay0GFSD6poxvkDV3YWSArIMx+qIlhE/SZfnKrE8TnyvQ5mDJlyugAVw2LUeUfv4wuwUXlDrZw0UBtOv5pPZJ6jtnlwHorSI6oSBgllrNRQ3SvTY3Xuos6WeVunAw9WUL1MXthTBCeWZCQ7ZtSaqMLUUbZXDU3aCDWSwyJd9eZU/6ztddxymtgDVSjdQMxaYX7qv6/5LpJ7MjOyO7yuDAICeTXjg0ZGPM7Qnxcx64luuBUolW1ffYasvFZt+p3XYmn3L0mbifk6ZZ1chX9w+m1RWiFsqTVvreqeaEYfQoCu5fCfy7GaTgne32D+aFiK5SVENuvhokmx1g6qg4+u4SywKCHW2nhFaycYj3oQ5PvbPyUs3ilNMY6DeIZXnN2v5QQJF/VCHfQwZ3F4V27pIHnfBqe5fhQ+b3QjpXeUo1Qi2uX76q7AcG+tgGojBULzjzQZuCshzFKjj6jvl9jTGngdoc0Ebb2Mpro1l/xRlkX4ziE44nNAz3UetcWfb3FSUZlRu3a1H4oHKJg0Rd3qS4jzq1N6h85VMYWSOmGmrshgeA1MgLa1ydqXD7es1cIGCdy8pDE+mg0KbzWiIeQhblr+ntXjY842Xi3jmf+a8AOEHqde3de1LUnCKvwtzzu1EjrVpvwiox3xzya9X1BCGWzE1Lb0umr9FyeoB7gXrtTuf3k9jTa3l6SQUJCC6nvoDhhQpe9m9tY7mg2owdOotHJ8t14wlHajoegqCFCAWfzhLB/8ecPx1PsPXdYNfLMeGnLOTotqlauvo/ByI5o5LWe5ZdDETG9dTQmQRvBJqxDeRIvzGeq+i+T08fbtNQqZnwu9SbvntakUQz6XacPe1QoqA/JqMROfYgTbJ1LHeEmGxr0QG1+zFcoCE6BVIKPknV5BQxGQLnzGHwrC9S8kPz+kgR6MLOPM1Ig++87DEkqXMA6NTK4bywM5CpX6lyqvt/9hwZmr3FvPnx9fq++1ErtW7lIKHhvE5dS73vJ7+fJTAMlZ3/3TQSCSucqLiw3HZf4PBorbcWKEUV0fga17YC1O2v6NKmISxPSEc3BdutO3EcaIHPV69t7F2mxocE9GoL9JHYK0kgm43QiSP58pM+2Ibu0SH0CDqNGapUVcQT6kaYsYnin8fMmEe+CSFoPyrAaCgs22Uh1ej+Yz1eeCL1t5H5AWb8dFjlOSPkF6CWyaIEp74tU3pUwW5VYD2eitzttrKjZZjykeRgSii0kAzEwgy0J3lbBYyByj9nvgbjBzTitxlaj/yhMvqKyrLHJ/nsuB09TXMUkgnfmOLjKeFBpv/Nu8j6H0Ysd8kai3UMaiAD07Ib+0= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 727afc9a-fdde-42f9-bdd3-08db8870de29 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2023 15:57:35.6196 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Rea4yXLnMHiybkNebnnFA5+Mtmo03MDijRuYaPn3Lw7QtJVL9kpaykearym4DuFl8bQEoFI6df+/HzAkkOoN8w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR04MB7399 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org From: Xiaowei Bao A workaround for the issue where the PCI Express Endpoint (EP) controller loses the values of the Maximum Link Width and Supported Link Speed from the Link Capabilities Register, which initially configured by the Reset Configuration Word (RCW) during a link-down or hot reset event. Fixes: a805770d8a22 ("PCI: layerscape: Add EP mode support") Acked-by: Manivannan Sadhasivam Signed-off-by: Xiaowei Bao Signed-off-by: Hou Zhiqiang Signed-off-by: Frank Li --- change from v2 to v3 - fix subject typo capabilities change from v1 to v2: - add comments at restore register - add fixes tag - dw_pcie_writew_dbi to dw_pcie_writel_dbi .../pci/controller/dwc/pci-layerscape-ep.c | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/dwc/pci-layerscape-ep.c b/drivers/pci/controller/dwc/pci-layerscape-ep.c index e0969ff2ddf7..39dbd911c3f8 100644 --- a/drivers/pci/controller/dwc/pci-layerscape-ep.c +++ b/drivers/pci/controller/dwc/pci-layerscape-ep.c @@ -45,6 +45,7 @@ struct ls_pcie_ep { struct pci_epc_features *ls_epc; const struct ls_pcie_ep_drvdata *drvdata; int irq; + u32 lnkcap; bool big_endian; }; @@ -73,6 +74,7 @@ static irqreturn_t ls_pcie_ep_event_handler(int irq, void *dev_id) struct ls_pcie_ep *pcie = dev_id; struct dw_pcie *pci = pcie->pci; u32 val, cfg; + u8 offset; val = ls_lut_readl(pcie, PEX_PF0_PME_MES_DR); ls_lut_writel(pcie, PEX_PF0_PME_MES_DR, val); @@ -81,12 +83,25 @@ static irqreturn_t ls_pcie_ep_event_handler(int irq, void *dev_id) return IRQ_NONE; if (val & PEX_PF0_PME_MES_DR_LUD) { + + offset = dw_pcie_find_capability(pci, PCI_CAP_ID_EXP); + + /* + * The values of the Maximum Link Width and Supported Link + * Speed from the Link Capabilities Register will be lost + * during link down or hot reset. Restore initial value + * that configured by the Reset Configuration Word (RCW). + */ + dw_pcie_dbi_ro_wr_en(pci); + dw_pcie_writel_dbi(pci, offset + PCI_EXP_LNKCAP, pcie->lnkcap); + dw_pcie_dbi_ro_wr_dis(pci); + cfg = ls_lut_readl(pcie, PEX_PF0_CONFIG); cfg |= PEX_PF0_CFG_READY; ls_lut_writel(pcie, PEX_PF0_CONFIG, cfg); dw_pcie_ep_linkup(&pci->ep); - dev_dbg(pci->dev, "Link up\n"); + dev_err(pci->dev, "Link up\n"); } else if (val & PEX_PF0_PME_MES_DR_LDD) { dev_dbg(pci->dev, "Link down\n"); pci_epc_linkdown(pci->ep.epc); @@ -216,6 +231,7 @@ static int __init ls_pcie_ep_probe(struct platform_device *pdev) struct ls_pcie_ep *pcie; struct pci_epc_features *ls_epc; struct resource *dbi_base; + u8 offset; int ret; pcie = devm_kzalloc(dev, sizeof(*pcie), GFP_KERNEL); @@ -252,6 +268,9 @@ static int __init ls_pcie_ep_probe(struct platform_device *pdev) platform_set_drvdata(pdev, pcie); + offset = dw_pcie_find_capability(pci, PCI_CAP_ID_EXP); + pcie->lnkcap = dw_pcie_readl_dbi(pci, offset + PCI_EXP_LNKCAP); + ret = dw_pcie_ep_init(&pci->ep); if (ret) return ret;