Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp1154371rdb; Fri, 1 Dec 2023 08:18:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IFjv/9eCgqLLM0OosxPTX7EekW4gRkSZO5Y37ZHdROFLeaSOAt4adyi53StcV2RSbzDcXUH X-Received: by 2002:a17:90b:1b4b:b0:285:b019:b4bb with SMTP id nv11-20020a17090b1b4b00b00285b019b4bbmr23482702pjb.47.1701447518214; Fri, 01 Dec 2023 08:18:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1701447518; cv=pass; d=google.com; s=arc-20160816; b=pjmIAdtCCA/p0g0pZYDBOA9QZ2sp6Y5PO/ipJiUxpuRvA2nCivLfUq790L1wv/y/wP 1jAvoxRvjS6r6HZ2mKxHMZlpSbHg4V5p5De2YK+v7Qs1BmB4/RVsxi6fzmrysVCkf6Lm PV/hAmQQPAc/zg/Cooj1ZpR8XFh+0plMVy2k/wJ0ZHkmCBo7OeEtUyeg1vsJbKgvOtfk 5F3HHq8OEPTM4I36WLOQwAp/b6rknsk5KOC3CLuFNSqhY1EHHH7EfhuXMDj9UdcojWAe U99MmKhD6iDUjDQG1ZojkPI5y0/OsznDU/0G5GPrTF+5qkJIChQUbSyk1A8KZbXjJDQV 7+JQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=JNYVfd/bi3kgw9foq8T63xE5hNVb3oc+FIB96u4aF74=; fh=G2Za2XEd7lFHZ2j3w8Am2dhf4mDmMexXUuvn1GAozXQ=; b=vQsPkOz+TLtihHRZSERAbDPZqH/E5Vm1Ow2VdaeYBEoQhPSfAGQ3F2BRIlABbja/nd yP1MF051nRdDknqUKKUpE8YXmTgiakKLjrc1Dr5RHNv1bi60PgAejpI87Ix2kZV4StTl LppOIY4s7loRx9uQ5VoqgpW9jcOaFGRmjqqQnvObha69U9p1mjdoFX4ZfzM2YUpVzcVD Ti6ITvsgFxV+E52kqPujhVkyxn45tFUFuxpzciK2abDRxio9/1v4QjPFq3owDBNt8KMq R//X5X/kiGpw/xp0evPRhk1pG4KRse5vnE2F+eyNADKgb4OHrqkK7Y+acxpSISiHsLeJ C5sw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=fgHjD5b0; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id d91-20020a17090a6f6400b0028555ec82easi5831162pjk.57.2023.12.01.08.18.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 08:18:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=fgHjD5b0; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 7372684118B4; Fri, 1 Dec 2023 08:18:33 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378537AbjLAQSD (ORCPT + 99 others); Fri, 1 Dec 2023 11:18:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378448AbjLAQRs (ORCPT ); Fri, 1 Dec 2023 11:17:48 -0500 Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2073.outbound.protection.outlook.com [40.107.247.73]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 556CE1BEB; Fri, 1 Dec 2023 08:17:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=h4enNaUtgCrSbmx/IbWIrrOP50av4DFN08wlPm8EF2+iS4NU0UXUkPOYn1Y1S2y6k4FAIhcy38fBzd/B91awe1QL3zyVQfN8fyJx31cKB955E7sW04VQTVG38elCCd+fdzTcMIlKA6MiCXB0uhI7eUtOeucg400SWf/CBMsmf/XhqKMKIjtA5bjN6iIEjkLOTbvCAcekx4oFHmkTi+/etp08voFSWxHhdeUe9cD4GiSdmv2amuKQSVWVyZCHp3+nakwrYGGRuE2YUudnGL/wa0rhvtpgoslxtdwlGXxNcUtpqTfpDQ0nKD1U2SOybU0WAOAvbuQGwbBZg3ZQdAxKUA== 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=JNYVfd/bi3kgw9foq8T63xE5hNVb3oc+FIB96u4aF74=; b=KvY9LRbc5K5itU37plZJLlcr19d8+EaGzxn4MdO5YvqrcyMiO99rECt2qXVs/SxwB57IZYpQo1sEEFOTJuIdaj1sby2SJMzwZbDhNcXVXEgHIQSg60jHf7hKli0AjmASXd2DENLNSX5Lf12haxPXkxqn+nvWNYVqUVqSv/3xhfci+R6ZbtG2ARVuhtb3D1/EgOz70SMzlCsf7xr5gF/074pL8/OS7n2KgGCrxFcxYtK24Rykh2HaZZrVxpdzERcOMJ4lK8g3WTbykTiAroCrJEO4AYXPZZwq94q84DaC/8MmSwsPoC+IJOrRzzQmm/QUZc2KAo6Ywx8WLsiKb7sYKQ== 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=JNYVfd/bi3kgw9foq8T63xE5hNVb3oc+FIB96u4aF74=; b=fgHjD5b0ghIXW050uoqs/xI4L/+/24QwRqapgFYcPbedpvgOF1CGzGYD8Plcbo2oAQczgkhMvVQVZNf/Fbs8nmPTDMG+B0iJkoUNRdVsz16Xg4/Lt0Dko6bf9KmmzSfjPMjIMEFOICagnop/0+w6ozTDFycb7V65XHDGDQYJUFU= 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 DU2PR04MB8695.eurprd04.prod.outlook.com (2603:10a6:10:2de::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.13; Fri, 1 Dec 2023 16:17:35 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::95f5:5118:258f:ee40]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::95f5:5118:258f:ee40%6]) with mapi id 15.20.7046.015; Fri, 1 Dec 2023 16:17:35 +0000 From: Frank Li To: manivannan.sadhasivam@linaro.org Cc: Frank.Li@nxp.com, bhelgaas@google.com, imx@lists.linux.dev, kw@linux.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, lpieralisi@kernel.org, minghuan.Lian@nxp.com, mingkai.hu@nxp.com, robh@kernel.org, roy.zang@nxp.com Subject: [PATCH v5 1/4] PCI: layerscape: Add function pointer for exit_from_l2() Date: Fri, 1 Dec 2023 11:17:09 -0500 Message-Id: <20231201161712.1645987-2-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231201161712.1645987-1-Frank.Li@nxp.com> References: <20231201161712.1645987-1-Frank.Li@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: BY5PR17CA0070.namprd17.prod.outlook.com (2603:10b6:a03:167::47) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|DU2PR04MB8695:EE_ X-MS-Office365-Filtering-Correlation-Id: 5a8db370-fd28-49b8-88f4-08dbf289072f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: c2UinjZJQFvoIEnYSAFkN3MCSwNGw/SAo6AFXoT+rNZMe35DeeCyoEwu3yy/LW2gJigWmZFkqjcDDI0TkbDk4lk4z4e/0yp5mrTtLgAYIYkWNOhP6u1aLfodQcSjIp4W2dsqXamP2YmtALs/AiKj48rNS64NNQspR/Hv3EaROJgZ0KfrdDkM9n+uitWoPt6OWTd168pt/uKZ7Vh+VvyVTpFvCkNUsjRKVXf0MtVl211ZijlxJDwx/3i1ygIzdqHqqigteO3PCPbDazmUqQWGZulEJUd/2LhQvDRc5O0dDOlO7byRynxFWMDpXfN9lzsqTz0XsqWEjnZSqxJHaKhk8qib9F2oTCaatnhSbIogLTFaRXiOz4SQe+kH0U0Ui0tzP8wabDC/pWu0r54/kZ2YX9sRYSgIlpCoZr/cOBK8dtjPI1G/6FU9c22uo6rcdrcd6KwwLZNTD9iJY09BA8Fr7FMzs+iaNYs3Gxz5tZrdL7BB6UOXV8K3kdFrJeiVw/24A7m4+uSrpaa7o0IEr8mb9r3D2H1xZAy1xt/3ajZzjGUXYQEKn1rH2qiD7r8vKfFOKoyXwWLPQ0QeJUPjlPPQWNTRar5Juzch3V981b4TSX+k4fd0TD8YJuDuNLh2H9Mh 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:(13230031)(136003)(366004)(376002)(396003)(39860400002)(346002)(230922051799003)(451199024)(64100799003)(186009)(1800799012)(38100700002)(38350700005)(6512007)(41300700001)(83380400001)(2616005)(316002)(6486002)(6916009)(52116002)(66556008)(66946007)(6666004)(6506007)(66476007)(478600001)(36756003)(5660300002)(2906002)(7416002)(26005)(4326008)(8676002)(8936002)(86362001)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?192dW7QJOVcsM+SLyFS68RhyUfE3soq5dZAB2etvStBq8rcDVU/JvgxGOGGM?= =?us-ascii?Q?+/pzW3WmqmL4AYaK7/xnwitkF5S0LpWxOZyEj7WQtz/hHy7b4PQKphloI0bH?= =?us-ascii?Q?e2/PlXZ57rfhs73nUZR9a7VSqLTs8QSZa8+Jamhv4j+ATTaxJZclJOd/cH8O?= =?us-ascii?Q?kGNygyev3rDGolP0+iSZn6ar16v4O5xAtNvWiyXPEOkW22yxrrvECbmR79sa?= =?us-ascii?Q?6q1KGYff+pAqhxKmKz2meZO/luX49eEoS8B4i+1RnUT6+Y6S20AEX3arArhZ?= =?us-ascii?Q?ypBcQ7ysaWP1GbGEzqyigDO4PWKN0PbNWdoiofBhMyA+XN6Chmt3D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uG9meiN8Z105CdJEEKHNIaKAwFxT++w3SXfB7ewkrttDMWfY7az?= =?us-ascii?Q?ejmouTBPsi+6ke5SD3oWLmQP5G/UAbFgnhBxStNQPbi4rICdvUo0yme+ypp7?= =?us-ascii?Q?1FPAS/nZXdethn9503RybDr1LV83N/y0mmGc2tGC/99ehcERrHoG1rBVaA6P?= =?us-ascii?Q?+oX4Zfhhs9gD2x2wVd7LH5hSXzAX3OL7cjgdC60vmDqR7BUKZYqt4M3ZLrLf?= =?us-ascii?Q?4UCjklAb3sugPo8RRBBLz/ifIHyyZ8qZcK9QF4ld/9TmWpA5dXeLzmdKVxqI?= =?us-ascii?Q?24zDYRhMG+TSzfEKd6MnZmcgidzhU6EsVOfM0w1fX8+ZqJSDdm+OdWasAfTI?= =?us-ascii?Q?KrhK11++C3IZUo55gS8kxy1/NjQRX5XB85ALry1o?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5a8db370-fd28-49b8-88f4-08dbf289072f X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2023 16:17:34.9604 (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: YQyO7d91WG7DJl2l3dfmgSWitYsRDhLV6iYWZ9ezB6nUxomjpLWwlXRe5PRSSjTGXIAwxM8mCDN+a3zhCTQi9g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8695 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Fri, 01 Dec 2023 08:18:33 -0800 (PST) Since difference SoCs require different sequence for exiting L2, let's add a separate "exit_from_l2()" callback. This callback can be used to execute SoC specific sequence. Change ls_pcie_exit_from_l2() return value from void to int. Return error if exit_from_l2() failure at exit resume flow. Reviewed-by: Manivannan Sadhasivam Signed-off-by: Frank Li --- Notes: Change from v4 to v5 - none Change from v3 to v4 - update commit message Add mani's review by tag Change from v2 to v3 - fixed according to mani's feedback 1. update commit message 2. move dw_pcie_host_ops to next patch 3. check return value from exit_from_l2() Change from v1 to v2 - change subject 'a' to 'A' Change from v1 to v2 - change subject 'a' to 'A' drivers/pci/controller/dwc/pci-layerscape.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-layerscape.c b/drivers/pci/controller/dwc/pci-layerscape.c index 37956e09c65bd..aea89926bcc4f 100644 --- a/drivers/pci/controller/dwc/pci-layerscape.c +++ b/drivers/pci/controller/dwc/pci-layerscape.c @@ -39,6 +39,7 @@ struct ls_pcie_drvdata { const u32 pf_off; + int (*exit_from_l2)(struct dw_pcie_rp *pp); bool pm_support; }; @@ -125,7 +126,7 @@ static void ls_pcie_send_turnoff_msg(struct dw_pcie_rp *pp) dev_err(pcie->pci->dev, "PME_Turn_off timeout\n"); } -static void ls_pcie_exit_from_l2(struct dw_pcie_rp *pp) +static int ls_pcie_exit_from_l2(struct dw_pcie_rp *pp) { struct dw_pcie *pci = to_dw_pcie_from_pp(pp); struct ls_pcie *pcie = to_ls_pcie(pci); @@ -150,6 +151,8 @@ static void ls_pcie_exit_from_l2(struct dw_pcie_rp *pp) 10000); if (ret) dev_err(pcie->pci->dev, "L2 exit timeout\n"); + + return ret; } static int ls_pcie_host_init(struct dw_pcie_rp *pp) @@ -180,6 +183,7 @@ static const struct ls_pcie_drvdata ls1021a_drvdata = { static const struct ls_pcie_drvdata layerscape_drvdata = { .pf_off = 0xc0000, .pm_support = true, + .exit_from_l2 = ls_pcie_exit_from_l2, }; static const struct of_device_id ls_pcie_of_match[] = { @@ -247,11 +251,14 @@ static int ls_pcie_suspend_noirq(struct device *dev) static int ls_pcie_resume_noirq(struct device *dev) { struct ls_pcie *pcie = dev_get_drvdata(dev); + int ret; if (!pcie->drvdata->pm_support) return 0; - ls_pcie_exit_from_l2(&pcie->pci->pp); + ret = pcie->drvdata->exit_from_l2(&pcie->pci->pp); + if (ret) + return ret; return dw_pcie_resume_noirq(pcie->pci); } -- 2.34.1