Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2811296rdb; Mon, 4 Dec 2023 08:09:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IHKOfK1DQgXbPXfEbFKL4ytWeLkKWVd20m+GpCk9BrLqNm/hZ9EAl68zoVKLvsVAthbndSZ X-Received: by 2002:a05:6a00:22cb:b0:6ce:63ff:50f0 with SMTP id f11-20020a056a0022cb00b006ce63ff50f0mr600377pfj.37.1701706153216; Mon, 04 Dec 2023 08:09:13 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1701706153; cv=pass; d=google.com; s=arc-20160816; b=WQRYUkiN/JFy3fAKwV1lNxxwhcPEcdK4OGKJk5sg4g2wfmqjL/PU9ZEDY2RKVvcej5 ehFva5SKbjdAY5Zintm8Zxi6y/odjJx+jvPr2exo2ZgC6IIkRWt2XsT3nD3HjryU14dF aJ8GI5h6cDvjq2MWifrNuCutEH9NMgFzoiMnbEQADiJNbPTpBx+R2T+cq3tkbhrXu30s k9vreSoh616SRxTuP9IXCKUSFxCHaUm4QtzNW0Iir1zMJbo2jNsvURNoSu4VsIQx4ljQ GOaWNqpb5ArxVzwuIwHwr8RO7KsyUS8d6e7Sc3B+viYDTNNUnXS1l09DTfxJbOET6QeK h4YA== 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=yTm6SVn/8Csl+QPlNDo2X2odB9csNy1A8DgDUr0Iiek=; fh=G2Za2XEd7lFHZ2j3w8Am2dhf4mDmMexXUuvn1GAozXQ=; b=g2gOqoQyHdi85WQgyMGWs0uEoOUn9WIvSl5572ZDJ18l6OL1b6c1rbOvRnvfeWjOyc rokFrV0/Cee4l0pZutegXZ8vgMpgjqG/Jv5eqbqh0OSnAKOr/RQMOJANIG/q9FKRwsyC hXoRn2Hwjd5IFaePf/3GF+8VsmiAn63jxxaS0cHbl+K/zbHxCgXfrT2Z8SY9pTnzhtb9 bFJLXmwZNxYO9SPHM79Sv/7KbqzgIL8ZlFCVpmKywwqoThDxRb/PPKWKcKNeMrGZPSej R3sYY7rwOK9gUaqv7+CisIbL/HMH5c1rmo/da+9ygOm3xMVK1ws0v55/u1SM+aBUpMWy 9zlQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=LYVeTANI; 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 23.128.96.38 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 fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id v19-20020a056a00149300b006ce5357404dsi1742945pfu.189.2023.12.04.08.09.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 08:09:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=LYVeTANI; 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 23.128.96.38 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 fry.vger.email (Postfix) with ESMTP id 05C1680972A1; Mon, 4 Dec 2023 08:09:10 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234969AbjLDQIx (ORCPT + 99 others); Mon, 4 Dec 2023 11:08:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234949AbjLDQIu (ORCPT ); Mon, 4 Dec 2023 11:08:50 -0500 Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2077.outbound.protection.outlook.com [40.107.247.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED383CA; Mon, 4 Dec 2023 08:08:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X46SCRsdphmXwLSOw+SYfxOp9j1C65IKvKlLx48tKRADZz2G5aZIjLi9NiPWei+bh5QSfTAZOGl0pyTJUd22vMCiLqCANbyUbffU9ItW7E1noy3wg2Xw6ymb3EcDH51ncwwS/sMVwE/xRkDRySKllvyfoen73iByCtak5fg6sC6pz8NnncbjJfWOk5POtUhFBBVJFrNehyreu0POBAN8P9+0o4pdX1j4oAQkc7cyzQKxmDEiwpZlZc10B8MA6XfQ2fwI06XuHl7JQawjbQwHhzqB1xqjWQU3TPDKCcZO/jrE1Q6i8jIBFj51gIosn64vpbSJa5nUBNvQRJ4NHYiccA== 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=yTm6SVn/8Csl+QPlNDo2X2odB9csNy1A8DgDUr0Iiek=; b=N8Tgfzt+Ag5+mbntbNBn9FM1mEfkdeVEUkUxawR2qsCPcnII+DNplrra8HrnJ5WIE8M5wVbV833tTkQEEmmSxEfGCWy7lOYbxjz+DRTWYjUKkvKb26/oFMGKKub6Bqyhz0tsZ1JoZq5BeVq5Bbds07waboP2niApDqA+MTXhygM1g03tcbM/DIY8Dmi0/afWm4X3/MKu2JQoq9Gj15W/Ij7XIkwXjVM5ZR/1dhxwjx9SmeF/LgGreGYgKMYVrByP3TRl3AbG8B7uto80HZN9OZvz/6can1CMsNSXcV//v22d3+tV7ira3IqBxHjaRb/KO70UI4Yq+nSj6ng+wz/tyQ== 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=yTm6SVn/8Csl+QPlNDo2X2odB9csNy1A8DgDUr0Iiek=; b=LYVeTANIMICT/oUKZDa/2qbz/oIpgnnWAM1nOgMtAt1AGJUFWXbIQCSIziprGDpZsKcyNk5k265etvMMGguZFPySNgD8YarIAyiWqRO1teTM74HuqK2TrJJwGyD4aMpsiBuRcvUHH2sRxzjiRVibCQmf9U3zDxmmwiAgBvWKyl8= 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 DBBPR04MB8057.eurprd04.prod.outlook.com (2603:10a6:10:1f1::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.22; Mon, 4 Dec 2023 16:08:52 +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.7068.022; Mon, 4 Dec 2023 16:08:52 +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 v6 1/4] PCI: layerscape: Add function pointer for exit_from_l2() Date: Mon, 4 Dec 2023 11:08:26 -0500 Message-Id: <20231204160829.2498703-2-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231204160829.2498703-1-Frank.Li@nxp.com> References: <20231204160829.2498703-1-Frank.Li@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: BYAPR21CA0027.namprd21.prod.outlook.com (2603:10b6:a03:114::37) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|DBBPR04MB8057:EE_ X-MS-Office365-Filtering-Correlation-Id: a297a239-6e34-491c-fef5-08dbf4e34ef6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5rSKVZ0hbaDyAowBg3i1DxOgKuJ3RtHJeCJzgqffi1seJgl9iM056NVQZU4aICIqwXWDNdVVIap+ZaUZXp4/Nno1ojYx4YMwIZ51N7mav9Hbjx+XV6aTpiFtduJ9KZXUWykJjKrV+0r7tyuv8N5pfnC+awx4IaQxaLqBOpJNuYA4iewTbybsYwzBs4ARsEK72nmm/udlK/WNzSO3sRBXswyAaRbSlHpdBryRciZ7EudU/7stak435xHakoxaNDb1TZhunxpJBORT8p4r46MWxni/W16u/ep/hmlFn8OGOHjwFEkATrHSZu51C8qOvRIBnlr2PffHu+8VIw5FutcsPPN2N1PQvVmV5xv8PTcpht/4pIa05FKGF4ntXmkFy8SZERtDtory46XADBb//9z4Q+pepUmLSDBRzVvAVEGsZ2OYnojun3BQFRESeMh+2FBoHuWhMwE+aV5jI0smWxzZFvMJMpb4q/9KG0L6BQN42s5FfZi+533oY2YaNLvbFKpapuKny9xCMpfiW+cjNGM4c09sfbsppmJhj6lhGi1wyZAJ0c9q/xtOrGTkBmJPJuuuRycOIWpLN3Us5/ok7e0qErQhQS+O/Cxe1mZvvmGUv2yupd02huKcnNsuIqjR/O++ 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)(396003)(136003)(39860400002)(366004)(376002)(346002)(230922051799003)(64100799003)(451199024)(1800799012)(186009)(6916009)(66556008)(66476007)(8936002)(316002)(86362001)(8676002)(4326008)(6486002)(478600001)(66946007)(36756003)(41300700001)(38350700005)(2906002)(7416002)(5660300002)(26005)(2616005)(1076003)(6506007)(6512007)(52116002)(83380400001)(6666004)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?KkiYNH/8GcLG+Pvsct5JMAYbvxWeMN0yHgYItaNXfaFBwnHzsmM+MxM7mOvm?= =?us-ascii?Q?jN+03Xhiq98cmDFZWsQsa1ReCfIJuK0pfQCEjS/bgzGKPbyeZEaGC/3vCUlO?= =?us-ascii?Q?Sbq38ItNpTw/gJavNLVYwtZQExn61xBlCWhRlZVEA98y2WvqZ+BkjZddWx2q?= =?us-ascii?Q?gC1/QiW6Jv53slFvsoyFJOii2JbG0PWLshGFyumfXiIKXiVBvAEzg6PGjUBe?= =?us-ascii?Q?WTqqCbsqkoTFRaVIEyysrQHtq6oSjfNR409VayIuwcDwUIZ8OHiZelhkpOdU?= =?us-ascii?Q?caAEdLxIT9FJy4SZuqNOgWBMQJVCPhTFWZDujvnDC3dK2HUIJNp7udQWXeTZ?= =?us-ascii?Q?UDLvFbWaubl9119C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?Q?ZN9/zj2DD2KWeyJ6oUp2i7eifDoJoyFPClPK3K+OZJorf81efdqm+D0FE9NC?= =?us-ascii?Q?zwMAUTDdCXhrtZqCaO0DS+uVunGdSVcpiZz21UqOQmo0GX1fv7+rTEofOAKV?= =?us-ascii?Q?jwtGSaC8JIfZ9tcGDcVtWRS2LAC0sFd5s5fSmozBvzrVSgTOING4WZF/6MJD?= =?us-ascii?Q?Ei0ZrSJqj0t/Omt6sNm0DvytCCrbq2kH1IzUwEhpxaVC2f9PtLM/18Y6m3sZ?= =?us-ascii?Q?Yr277/NXLRQU23q7IHYD0uYzVjgHKXE6EuPje2rdGB0YpRveFFxJE9UiIAiT?= =?us-ascii?Q?O7aFoaR7XeaYf7BITexuG9Dnxw5djgt+5pMHjgec?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a297a239-6e34-491c-fef5-08dbf4e34ef6 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2023 16:08:52.4875 (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: 4WT6ZXki8n3zg+fyUngGpN2+dRd90lSYd0+rKnE7uOYK72/KQsk0jT6f61yaIb4xPQSPc6fvd/tyUyjV85YEqw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB8057 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 fry.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 (fry.vger.email [0.0.0.0]); Mon, 04 Dec 2023 08:09:10 -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. Acked-by: Roy Zang Reviewed-by: Manivannan Sadhasivam Signed-off-by: Frank Li --- Notes: Change from v4 to v6 - 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