From patchwork Tue Feb 27 21:47:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 207454 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2983544dyb; Tue, 27 Feb 2024 13:49:01 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV4UpKD/mT+KkzaMMled0yVhU4fCA2ttV2Kfj6cfvSgA8cNNXA47dTnkYELHcC3kqZsgE8o+15MC5DC/XtUmgCc7AXs2g== X-Google-Smtp-Source: AGHT+IECJCPDMucLtX7L1CUs23ohCFUVDK29bAbAyZIHsB0sbogM8clYaC7EUlUzE5m8pZgqOgxw X-Received: by 2002:a05:620a:8505:b0:787:ef82:65c7 with SMTP id pe5-20020a05620a850500b00787ef8265c7mr307172qkn.5.1709070540933; Tue, 27 Feb 2024 13:49:00 -0800 (PST) Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id z25-20020a05620a08d900b007876c39c716si8247416qkz.258.2024.02.27.13.49.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 13:49:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-84064-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=EdJJf2p0; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-84064-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84064-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 9321E1C26C4A for ; Tue, 27 Feb 2024 21:49:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D94CD14F98F; Tue, 27 Feb 2024 21:47:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="EdJJf2p0" Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02on2066.outbound.protection.outlook.com [40.107.241.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BFD4114F96A; Tue, 27 Feb 2024 21:47:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.241.66 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709070463; cv=fail; b=ke8VMgD0WNcrAQ9E7V6MsLFMTx7NwQTCp2GbjCynhbTP1I4eVBOBdaPr9BOYfD/+dItzyuAocSUn2J467KrtN/Xptr+s6Yy8A90W1R8YNF+RUacgS5o+QUuiggUPKMhCJg1PnjBnRfzjOHphVCQ3n+woyxmfjtvJ63mBjH1Qk68= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709070463; c=relaxed/simple; bh=BUCqGUNZzlD88oIifleyzyYvW7jr0jN9Yy/P+faiggI=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=c68DPMRQww2sadNiYw28E6B1nN36caIP6hi5Ah2pKJSOrEn3B6aHLMV0mCuYQlEUqUptE8h2HCA6OGOP7kWv1R6zjmlXDqDKou0gywbfZx0oaNfrYb2NKDSCWJUjWEUgbutwpzh1eHxY7tiRj4IOiBudSk1fJc9+vxvM+5dgCOw= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=EdJJf2p0; arc=fail smtp.client-ip=40.107.241.66 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Nrs8U1zR5xvxtJJCVPIKlSDTYa2m1o7HYhu/agResyzcDDwTbKUitBKB7aTOvSzij13NAYBEXKpC/NTzudZXZQCozISrYR+SFnDKt0MKpV4xqa8h/0G1yzpSt3DawT+/CKjNw8ZbHchQl3M94Cs/mufpl66TTOJeFbxmsALgyqH5KhO9wdg/zGZLuIo0XHs34KUk+qTY4QjaORNBCGW/ga3708E1qjDcFtPdYpjpYPpH+jErNWco+WGwqlRyRzLeQbDBeuLNdIKiD8+W/xTUoxwA0MDBBt//02OM99+rxUk5+i3sBUx4BafHePooQsuY4Bvjm6Pup+b7E0a4XzVTgA== 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=0/mcDFJTjJNCwI9eGlJAY8MoAu+qTAZLoaXfcZFsN/U=; b=KRT6bHV/soQk4ZFNEs0RmU9CLeoT4jKhyM6PVUagPE92ctsiP8P5D6MzaUe2tHWUz/rdYtrSzYZEmvqlOyxP/Lwkk5H2Mwa0+Uj82kY7joy1Pd/HFwrAEKBcj7Lsc5oCEg7y0VIz0RIliHQgLw/8rMpl5BTwKTkw+LYVcOAlj7O/BttIviAI83Vrhap4bKSqYhZJ9Sfk/GBtoTvxa6xaF/iEasev4wiJykvSFrPdK219oeijR5iV+GXOOPrf0qprYOcaOWJyknO/NZC7X8wflWSRmgrhXfP2lgm1RVgs6lLbGpN0mjumrofIEeCN4KUW4gUm0wtF5SJJTuk6bCYRxw== 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=0/mcDFJTjJNCwI9eGlJAY8MoAu+qTAZLoaXfcZFsN/U=; b=EdJJf2p0DQfp4skb3x3qnOa3f1ms0t7rXYtDY0ysQ4BiCsALn4bBounf+O5Ks6KkoC0MBj+opNjZEXx0Ry9JBA3GenWnrBzPjBjj8YRRmGPd/he9fLDI5PAT8LkFKeb3roEwJMdssrlo+VHjfW1MINaE6KsVoBanJMMFRWntg38= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by AS8PR04MB7893.eurprd04.prod.outlook.com (2603:10a6:20b:2ab::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.36; Tue, 27 Feb 2024 21:47:37 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9af4:87e:d74:94aa]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9af4:87e:d74:94aa%7]) with mapi id 15.20.7316.035; Tue, 27 Feb 2024 21:47:37 +0000 From: Frank Li Date: Tue, 27 Feb 2024 16:47:08 -0500 Subject: [PATCH 1/6] PCI: imx6: Rename imx6_* with imx_* Message-Id: <20240227-pci2_upstream-v1-1-b952f8333606@nxp.com> References: <20240227-pci2_upstream-v1-0-b952f8333606@nxp.com> In-Reply-To: <20240227-pci2_upstream-v1-0-b952f8333606@nxp.com> To: Richard Zhu , Lucas Stach , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Rob Herring , Bjorn Helgaas , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Philipp Zabel , Liam Girdwood , Mark Brown Cc: linux-pci@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, Frank Li X-Mailer: b4 0.13-dev-c87ef X-Developer-Signature: v=1; a=ed25519-sha256; t=1709070448; l=59471; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=BUCqGUNZzlD88oIifleyzyYvW7jr0jN9Yy/P+faiggI=; b=bfdQn6ScW2Gu6XHTuLi9WpgHw9AYAI4s1LuGFv09o3qv0OdCtdbX1cc+MgpMlNXlFhIbUrLJo 2wmBph8FcCvDqqXhQirNE0Hpjt+3NYNzMuHMIgxBWKVAc9XZFk8d+sr X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR11CA0050.namprd11.prod.outlook.com (2603:10b6:a03:80::27) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AS8PR04MB7893:EE_ X-MS-Office365-Filtering-Correlation-Id: 6eeb81be-9f7e-4cd3-d602-08dc37ddb6d8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ra2K4owULvABi1al5ngTUvQ5tQAtY+zt5qJpWnLkUue9d1nlfqWsWvh1WhadCvY3ZEF1Y0MaRh2+f0Chcx4U/1qCupnsTgcw0VzGdfqDJeqyQ+YF6dU/bdTJjU3HB5teJuGIYBXhHxjtpsck+IFqrVECN+yfutv8N5WPd3mHSj9OFFtGF5oEKNF6K4AjRiCB2l57VU9XEpkK36o82kzWF2RLO2l95A/mBhtwW4rIQD9opot91h8BUgE2ynu7ydeiCKS0Q5fstxHwK5a2MjapL1DgBONQgk+FRDkJxG5K1X6by4LhBsYtXQayMWT+oJuZ8gb1NWcmEdvLTLzN55zLtdsVsve0SMMqMyj2L0RzToeKupZ/FiTf8+dBpvQNQ9Y1BR+ENltr4VzUaq4RZBAw6sjyNKxVChax3q4LFNjGV9iVsoJz10KYdA3/wRo8QbUIqbGOGK9C4Sil7fv2nxpdotPR1wfwlIqLDYF+dhbbdvtWpLDNW/RCrB4VPcFltZWhDneIsEvwO4vy378PI6AG0hdcvOUiRecRFYkP7OlgFCI3V0hQYm1l40JQWo6t7fiX9tsyXgMY3JwDdUj9aMyg4eJJ5pOwN6pbdRwhznofR8b1ldUzbVZjkf3k1Y+iLNVdrmaWBrRF/q9+LXaF5pp3B3A+fiUV+UGu2YQXge92nqaWGZDv8uT2Od+4eur9T5UTnpkH5CwVshU6ROIkGHsa6H8xvYndR+t88YHPzPOKThI= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(230273577357003)(921011)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?ZlVt2eioAAdDwNH/Xi3jhUpvuI91?= =?utf-8?q?CIsNqtOznpeU+UBIDaP+Czrtt9pWpLEZP3ampQ72I9U5iJL8Exlt1gPF4U6Toxh0m?= =?utf-8?q?irgUWNz9zXg69+3AbG5zqon9akzR1g94soXrSorCRaIGEQW0txv9b07JwkItI/PdS?= =?utf-8?q?my5FOvZG4T0xRe9/lCfUfhQfYW+UzikosEBcjtRCaTnL+VonhUjfcEGtL6vmx7Q8w?= =?utf-8?q?9DYTZr82mMql9b4WWUPhQxxSlCLqd8TuJiJ6mk0+RsgzsFkBJ6KBSZsBnipdF0GRY?= =?utf-8?q?icsfMm8s5ag+c152XULl7rnW2za+EEyonHnP44e49DDzfRYcRyiJ4nxM4DupTO0Sf?= =?utf-8?q?jlCAKLHj842LlujNwBRmslMtPiZgopI3FgfFeCRIm89qTpy3jS701LsjkhjzBMDJl?= =?utf-8?q?jJCyJFuWnwE9rMaEAA0CKTJ9oApbpj2c2AWcdZBRHm6Ib0N7Hzb9BE1DGgsOlujeC?= =?utf-8?q?illr5+Vep5bpVQx5ueGXzB13A44rVU/be3NNuNgDyS0o54ie1mXbTM+zaEoLXvYxE?= =?utf-8?q?PgU8JTU4OwOXGD8vQkItLm647pZp7k7O0xrqEBz33nEtRMVBJjf8ymD9fEeqz31Xo?= =?utf-8?q?cSyCzJw0I9PmSw6iOU93Ap9LIYhiUyAJ39OPXqay1QHRZczA8MqYgRolCj9Gdc9Td?= =?utf-8?q?oTHnTKrn7aFeruk1rS27lW9ahI9pl2ByPGtAHy+xHRDVS4JRi2yHN1MbTIHxKf+Po?= =?utf-8?q?0JCyzuqrSqBzl3r2+n/c1d8pafQTOaIp1LLlwsZA9HeXoW62XObSOM4rCbLkTcHvi?= =?utf-8?q?BEuRHReNO0hKPAoGmfgEbW88I4Dp1da54WR8fDEyDdkxHR5AyDElR9r0dM7qoTy9N?= =?utf-8?q?bBtAUzO4ZOZPKRAdglW2KM/rhJxjRCjYoZzLir6J9fVo0X3jn3tNMN6nZwkTH5797?= =?utf-8?q?596wIeuYxRiYrH5VeacR5A8ZTiceMNZK24QPRzCe3DXWtD5fJSFXVsv/sEjTF3Vgz?= =?utf-8?q?QXvRLmB0o/IyRtaabbzHl7odkRsT1fb24fiZAHBHwdWs1Ba+cvey5QgbdgELzhTnh?= =?utf-8?q?xbXIqljp6OwlNXzwEeQ6aE8m8zlUI48/SjUdaiDRDJ0Uvv3tbqEocnwPgUSJ+auF0?= =?utf-8?q?H2T1rmehi0JH8RP/tsHGZUFKa4crufMhcA23QEizo6+bqlBtb/va+CURMAjVWwqRe?= =?utf-8?q?sUsTuUQONwFWCfB6nCO3V3cmO106QhD0BjK2OeyN54I4tXRIbX1lBKNv+6QhqQOM4?= =?utf-8?q?aDcDDkuTzjQgIdlH5qqHc5jb7fQx9k433SzGo6VDEtKNPipLkh9egH4Mb6PmpHLEO?= =?utf-8?q?znldC6QnpqtN3e0GRw6epdl0qCkFwVGTfGPIgsoXRyo3G2xKAwubrWQXigvPl6luv?= =?utf-8?q?UerqhMekILuuhIKXCg/ZcILDkhDKwX+L4PslFMXKCySr2lq+Mq6MgdugZOf4sTcvD?= =?utf-8?q?Il/E4LTaP+am4MurFKPgWiAXZcIcxSeiuWOv89C6rWqKZEt8QwbtcTRiCOXXqblfG?= =?utf-8?q?opVjrB6Tpwo/xVb/Dc5r0a3WAHEe9C1Lb0EuOwOe/TKiPbDJ1bw89WgZo7Z5wer5+?= =?utf-8?q?qvRX93BssSiU?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6eeb81be-9f7e-4cd3-d602-08dc37ddb6d8 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Feb 2024 21:47:37.7106 (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: UQJXOXKqXzgHeKvJVIu2io2UNtGNurs8H3Nv/9saJqxT+wx6H/E5m29KsvMN8YcKBM5ZpxBrXWkgOASgE5DfEQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7893 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792090351754507723 X-GMAIL-MSGID: 1792090351754507723 imx6_* actually mean for all imx chips (imx6x, imx7x, imx8x and imx9x). Rename imx6_* with imx_* to avoid confuse. Signed-off-by: Frank Li --- drivers/pci/controller/dwc/pci-imx6.c | 754 +++++++++++++++++----------------- 1 file changed, 377 insertions(+), 377 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 7cd165d03649f..e646ad70a2a5e 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -55,9 +55,9 @@ #define IMX95_PE0_GEN_CTRL_3 0x1058 #define IMX95_PCIE_LTSSM_EN BIT(0) -#define to_imx6_pcie(x) dev_get_drvdata((x)->dev) +#define to_imx_pcie(x) dev_get_drvdata((x)->dev) -enum imx6_pcie_variants { +enum imx_pcie_variants { IMX6Q, IMX6SX, IMX6QP, @@ -72,25 +72,25 @@ enum imx6_pcie_variants { IMX95_EP, }; -#define IMX6_PCIE_FLAG_IMX6_PHY BIT(0) -#define IMX6_PCIE_FLAG_IMX6_SPEED_CHANGE BIT(1) -#define IMX6_PCIE_FLAG_SUPPORTS_SUSPEND BIT(2) -#define IMX6_PCIE_FLAG_HAS_PHYDRV BIT(3) -#define IMX6_PCIE_FLAG_HAS_APP_RESET BIT(4) -#define IMX6_PCIE_FLAG_HAS_PHY_RESET BIT(5) -#define IMX6_PCIE_FLAG_HAS_SERDES BIT(6) -#define IMX6_PCIE_FLAG_SUPPORT_64BIT BIT(7) +#define IMX_PCIE_FLAG_IMX_PHY BIT(0) +#define IMX_PCIE_FLAG_IMX_SPEED_CHANGE BIT(1) +#define IMX_PCIE_FLAG_SUPPORTS_SUSPEND BIT(2) +#define IMX_PCIE_FLAG_HAS_PHYDRV BIT(3) +#define IMX_PCIE_FLAG_HAS_APP_RESET BIT(4) +#define IMX_PCIE_FLAG_HAS_PHY_RESET BIT(5) +#define IMX_PCIE_FLAG_HAS_SERDES BIT(6) +#define IMX_PCIE_FLAG_SUPPORT_64BIT BIT(7) -#define imx6_check_flag(pci, val) (pci->drvdata->flags & val) +#define imx_check_flag(pci, val) (pci->drvdata->flags & val) -#define IMX6_PCIE_MAX_CLKS 6 +#define IMX_PCIE_MAX_CLKS 6 -#define IMX6_PCIE_MAX_INSTANCES 2 +#define IMX_PCIE_MAX_INSTANCES 2 -struct imx6_pcie; +struct imx_pcie; -struct imx6_pcie_drvdata { - enum imx6_pcie_variants variant; +struct imx_pcie_drvdata { + enum imx_pcie_variants variant; enum dw_pcie_device_mode mode; u32 flags; int dbi_length; @@ -99,18 +99,18 @@ struct imx6_pcie_drvdata { const u32 clks_cnt; const u32 ltssm_off; const u32 ltssm_mask; - const u32 mode_off[IMX6_PCIE_MAX_INSTANCES]; - const u32 mode_mask[IMX6_PCIE_MAX_INSTANCES]; + const u32 mode_off[IMX_PCIE_MAX_INSTANCES]; + const u32 mode_mask[IMX_PCIE_MAX_INSTANCES]; const struct pci_epc_features *epc_features; - int (*init_phy)(struct imx6_pcie *pcie); + int (*init_phy)(struct imx_pcie *pcie); }; -struct imx6_pcie { +struct imx_pcie { struct dw_pcie *pci; int reset_gpio; bool gpio_active_high; bool link_is_up; - struct clk_bulk_data clks[IMX6_PCIE_MAX_CLKS]; + struct clk_bulk_data clks[IMX_PCIE_MAX_CLKS]; struct regmap *iomuxc_gpr; u16 msi_ctrl; u32 controller_id; @@ -131,7 +131,7 @@ struct imx6_pcie { /* power domain for pcie phy */ struct device *pd_pcie_phy; struct phy *phy; - const struct imx6_pcie_drvdata *drvdata; + const struct imx_pcie_drvdata *drvdata; }; /* Parameters for the waiting for PCIe PHY PLL to lock on i.MX7 */ @@ -186,28 +186,28 @@ struct imx6_pcie { #define PHY_RX_OVRD_IN_LO_RX_DATA_EN BIT(5) #define PHY_RX_OVRD_IN_LO_RX_PLL_EN BIT(3) -static unsigned int imx6_pcie_grp_offset(const struct imx6_pcie *imx6_pcie) +static unsigned int imx_pcie_grp_offset(const struct imx_pcie *imx_pcie) { - WARN_ON(imx6_pcie->drvdata->variant != IMX8MQ && - imx6_pcie->drvdata->variant != IMX8MQ_EP && - imx6_pcie->drvdata->variant != IMX8MM && - imx6_pcie->drvdata->variant != IMX8MM_EP && - imx6_pcie->drvdata->variant != IMX8MP && - imx6_pcie->drvdata->variant != IMX8MP_EP); - return imx6_pcie->controller_id == 1 ? IOMUXC_GPR16 : IOMUXC_GPR14; + WARN_ON(imx_pcie->drvdata->variant != IMX8MQ && + imx_pcie->drvdata->variant != IMX8MQ_EP && + imx_pcie->drvdata->variant != IMX8MM && + imx_pcie->drvdata->variant != IMX8MM_EP && + imx_pcie->drvdata->variant != IMX8MP && + imx_pcie->drvdata->variant != IMX8MP_EP); + return imx_pcie->controller_id == 1 ? IOMUXC_GPR16 : IOMUXC_GPR14; } -static int imx95_pcie_init_phy(struct imx6_pcie *imx6_pcie) +static int imx95_pcie_init_phy(struct imx_pcie *imx_pcie) { - regmap_update_bits(imx6_pcie->iomuxc_gpr, + regmap_update_bits(imx_pcie->iomuxc_gpr, IMX95_PCIE_SS_RW_REG_0, IMX95_PCIE_PHY_CR_PARA_SEL, IMX95_PCIE_PHY_CR_PARA_SEL); - regmap_update_bits(imx6_pcie->iomuxc_gpr, + regmap_update_bits(imx_pcie->iomuxc_gpr, IMX95_PCIE_PHY_GEN_CTRL, IMX95_PCIE_REF_USE_PAD, 0); - regmap_update_bits(imx6_pcie->iomuxc_gpr, + regmap_update_bits(imx_pcie->iomuxc_gpr, IMX95_PCIE_SS_RW_REG_0, IMX95_PCIE_REF_CLKEN, IMX95_PCIE_REF_CLKEN); @@ -215,9 +215,9 @@ static int imx95_pcie_init_phy(struct imx6_pcie *imx6_pcie) return 0; } -static void imx6_pcie_configure_type(struct imx6_pcie *imx6_pcie) +static void imx_pcie_configure_type(struct imx_pcie *imx_pcie) { - const struct imx6_pcie_drvdata *drvdata = imx6_pcie->drvdata; + const struct imx_pcie_drvdata *drvdata = imx_pcie->drvdata; unsigned int mask, val, mode, id; if (drvdata->mode == DW_PCIE_EP_TYPE) @@ -225,7 +225,7 @@ static void imx6_pcie_configure_type(struct imx6_pcie *imx6_pcie) else mode = PCI_EXP_TYPE_ROOT_PORT; - id = imx6_pcie->controller_id; + id = imx_pcie->controller_id; /* If mode_mask[id] is zero, means each controller have its individual gpr */ if (!drvdata->mode_mask[id]) @@ -234,12 +234,12 @@ static void imx6_pcie_configure_type(struct imx6_pcie *imx6_pcie) mask = drvdata->mode_mask[id]; val = mode << (ffs(mask) - 1); - regmap_update_bits(imx6_pcie->iomuxc_gpr, drvdata->mode_off[id], mask, val); + regmap_update_bits(imx_pcie->iomuxc_gpr, drvdata->mode_off[id], mask, val); } -static int pcie_phy_poll_ack(struct imx6_pcie *imx6_pcie, bool exp_val) +static int pcie_phy_poll_ack(struct imx_pcie *imx_pcie, bool exp_val) { - struct dw_pcie *pci = imx6_pcie->pci; + struct dw_pcie *pci = imx_pcie->pci; bool val; u32 max_iterations = 10; u32 wait_counter = 0; @@ -258,9 +258,9 @@ static int pcie_phy_poll_ack(struct imx6_pcie *imx6_pcie, bool exp_val) return -ETIMEDOUT; } -static int pcie_phy_wait_ack(struct imx6_pcie *imx6_pcie, int addr) +static int pcie_phy_wait_ack(struct imx_pcie *imx_pcie, int addr) { - struct dw_pcie *pci = imx6_pcie->pci; + struct dw_pcie *pci = imx_pcie->pci; u32 val; int ret; @@ -270,24 +270,24 @@ static int pcie_phy_wait_ack(struct imx6_pcie *imx6_pcie, int addr) val |= PCIE_PHY_CTRL_CAP_ADR; dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, val); - ret = pcie_phy_poll_ack(imx6_pcie, true); + ret = pcie_phy_poll_ack(imx_pcie, true); if (ret) return ret; val = PCIE_PHY_CTRL_DATA(addr); dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, val); - return pcie_phy_poll_ack(imx6_pcie, false); + return pcie_phy_poll_ack(imx_pcie, false); } /* Read from the 16-bit PCIe PHY control registers (not memory-mapped) */ -static int pcie_phy_read(struct imx6_pcie *imx6_pcie, int addr, u16 *data) +static int pcie_phy_read(struct imx_pcie *imx_pcie, int addr, u16 *data) { - struct dw_pcie *pci = imx6_pcie->pci; + struct dw_pcie *pci = imx_pcie->pci; u32 phy_ctl; int ret; - ret = pcie_phy_wait_ack(imx6_pcie, addr); + ret = pcie_phy_wait_ack(imx_pcie, addr); if (ret) return ret; @@ -295,7 +295,7 @@ static int pcie_phy_read(struct imx6_pcie *imx6_pcie, int addr, u16 *data) phy_ctl = PCIE_PHY_CTRL_RD; dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, phy_ctl); - ret = pcie_phy_poll_ack(imx6_pcie, true); + ret = pcie_phy_poll_ack(imx_pcie, true); if (ret) return ret; @@ -304,18 +304,18 @@ static int pcie_phy_read(struct imx6_pcie *imx6_pcie, int addr, u16 *data) /* deassert Read signal */ dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, 0x00); - return pcie_phy_poll_ack(imx6_pcie, false); + return pcie_phy_poll_ack(imx_pcie, false); } -static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, u16 data) +static int pcie_phy_write(struct imx_pcie *imx_pcie, int addr, u16 data) { - struct dw_pcie *pci = imx6_pcie->pci; + struct dw_pcie *pci = imx_pcie->pci; u32 var; int ret; /* write addr */ /* cap addr */ - ret = pcie_phy_wait_ack(imx6_pcie, addr); + ret = pcie_phy_wait_ack(imx_pcie, addr); if (ret) return ret; @@ -326,7 +326,7 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, u16 data) var |= PCIE_PHY_CTRL_CAP_DAT; dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var); - ret = pcie_phy_poll_ack(imx6_pcie, true); + ret = pcie_phy_poll_ack(imx_pcie, true); if (ret) return ret; @@ -335,7 +335,7 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, u16 data) dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var); /* wait for ack de-assertion */ - ret = pcie_phy_poll_ack(imx6_pcie, false); + ret = pcie_phy_poll_ack(imx_pcie, false); if (ret) return ret; @@ -344,7 +344,7 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, u16 data) dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var); /* wait for ack */ - ret = pcie_phy_poll_ack(imx6_pcie, true); + ret = pcie_phy_poll_ack(imx_pcie, true); if (ret) return ret; @@ -353,7 +353,7 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, u16 data) dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var); /* wait for ack de-assertion */ - ret = pcie_phy_poll_ack(imx6_pcie, false); + ret = pcie_phy_poll_ack(imx_pcie, false); if (ret) return ret; @@ -362,74 +362,74 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, u16 data) return 0; } -static int imx8mq_pcie_init_phy(struct imx6_pcie *imx6_pcie) +static int imx8mq_pcie_init_phy(struct imx_pcie *imx_pcie) { /* TODO: Currently this code assumes external oscillator is being used */ - regmap_update_bits(imx6_pcie->iomuxc_gpr, - imx6_pcie_grp_offset(imx6_pcie), + regmap_update_bits(imx_pcie->iomuxc_gpr, + imx_pcie_grp_offset(imx_pcie), IMX8MQ_GPR_PCIE_REF_USE_PAD, IMX8MQ_GPR_PCIE_REF_USE_PAD); /* * Regarding the datasheet, the PCIE_VPH is suggested to be 1.8V. If the PCIE_VPH is * supplied by 3.3V, the VREG_BYPASS should be cleared to zero. */ - if (imx6_pcie->vph && regulator_get_voltage(imx6_pcie->vph) > 3000000) - regmap_update_bits(imx6_pcie->iomuxc_gpr, - imx6_pcie_grp_offset(imx6_pcie), + if (imx_pcie->vph && regulator_get_voltage(imx_pcie->vph) > 3000000) + regmap_update_bits(imx_pcie->iomuxc_gpr, + imx_pcie_grp_offset(imx_pcie), IMX8MQ_GPR_PCIE_VREG_BYPASS, 0); return 0; } -static int imx7d_pcie_init_phy(struct imx6_pcie *imx6_pcie) +static int imx7d_pcie_init_phy(struct imx_pcie *imx_pcie) { - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX7D_GPR12_PCIE_PHY_REFCLK_SEL, 0); + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX7D_GPR12_PCIE_PHY_REFCLK_SEL, 0); return 0; } -static int imx6_pcie_init_phy(struct imx6_pcie *imx6_pcie) +static int imx_pcie_init_phy(struct imx_pcie *imx_pcie) { - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX6Q_GPR12_PCIE_CTL_2, 0 << 10); /* configure constant input signal to the pcie ctrl and phy */ - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX6Q_GPR12_LOS_LEVEL, 9 << 4); - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR8, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR8, IMX6Q_GPR8_TX_DEEMPH_GEN1, - imx6_pcie->tx_deemph_gen1 << 0); - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR8, + imx_pcie->tx_deemph_gen1 << 0); + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR8, IMX6Q_GPR8_TX_DEEMPH_GEN2_3P5DB, - imx6_pcie->tx_deemph_gen2_3p5db << 6); - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR8, + imx_pcie->tx_deemph_gen2_3p5db << 6); + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR8, IMX6Q_GPR8_TX_DEEMPH_GEN2_6DB, - imx6_pcie->tx_deemph_gen2_6db << 12); - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR8, + imx_pcie->tx_deemph_gen2_6db << 12); + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR8, IMX6Q_GPR8_TX_SWING_FULL, - imx6_pcie->tx_swing_full << 18); - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR8, + imx_pcie->tx_swing_full << 18); + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR8, IMX6Q_GPR8_TX_SWING_LOW, - imx6_pcie->tx_swing_low << 25); + imx_pcie->tx_swing_low << 25); return 0; } -static int imx6sx_pcie_init_phy(struct imx6_pcie *imx6_pcie) +static int imx6sx_pcie_init_phy(struct imx_pcie *imx_pcie) { - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX6SX_GPR12_PCIE_RX_EQ_MASK, IMX6SX_GPR12_PCIE_RX_EQ_2); - return imx6_pcie_init_phy(imx6_pcie); + return imx_pcie_init_phy(imx_pcie); } -static void imx7d_pcie_wait_for_phy_pll_lock(struct imx6_pcie *imx6_pcie) +static void imx7d_pcie_wait_for_phy_pll_lock(struct imx_pcie *imx_pcie) { u32 val; - struct device *dev = imx6_pcie->pci->dev; + struct device *dev = imx_pcie->pci->dev; - if (regmap_read_poll_timeout(imx6_pcie->iomuxc_gpr, + if (regmap_read_poll_timeout(imx_pcie->iomuxc_gpr, IOMUXC_GPR22, val, val & IMX7D_GPR22_PCIE_PHY_PLL_LOCKED, PHY_PLL_LOCK_WAIT_USLEEP_MAX, @@ -437,19 +437,19 @@ static void imx7d_pcie_wait_for_phy_pll_lock(struct imx6_pcie *imx6_pcie) dev_err(dev, "PCIe PLL lock timeout\n"); } -static int imx6_setup_phy_mpll(struct imx6_pcie *imx6_pcie) +static int imx_setup_phy_mpll(struct imx_pcie *imx_pcie) { unsigned long phy_rate = 0; int mult, div; u16 val; int i; - if (!(imx6_pcie->drvdata->flags & IMX6_PCIE_FLAG_IMX6_PHY)) + if (!(imx_pcie->drvdata->flags & IMX_PCIE_FLAG_IMX_PHY)) return 0; - for (i = 0; i < imx6_pcie->drvdata->clks_cnt; i++) - if (strncmp(imx6_pcie->clks[i].id, "pcie_phy", 8) == 0) - phy_rate = clk_get_rate(imx6_pcie->clks[i].clk); + for (i = 0; i < imx_pcie->drvdata->clks_cnt; i++) + if (strncmp(imx_pcie->clks[i].id, "pcie_phy", 8) == 0) + phy_rate = clk_get_rate(imx_pcie->clks[i].clk); switch (phy_rate) { case 125000000: @@ -467,46 +467,46 @@ static int imx6_setup_phy_mpll(struct imx6_pcie *imx6_pcie) div = 1; break; default: - dev_err(imx6_pcie->pci->dev, + dev_err(imx_pcie->pci->dev, "Unsupported PHY reference clock rate %lu\n", phy_rate); return -EINVAL; } - pcie_phy_read(imx6_pcie, PCIE_PHY_MPLL_OVRD_IN_LO, &val); + pcie_phy_read(imx_pcie, PCIE_PHY_MPLL_OVRD_IN_LO, &val); val &= ~(PCIE_PHY_MPLL_MULTIPLIER_MASK << PCIE_PHY_MPLL_MULTIPLIER_SHIFT); val |= mult << PCIE_PHY_MPLL_MULTIPLIER_SHIFT; val |= PCIE_PHY_MPLL_MULTIPLIER_OVRD; - pcie_phy_write(imx6_pcie, PCIE_PHY_MPLL_OVRD_IN_LO, val); + pcie_phy_write(imx_pcie, PCIE_PHY_MPLL_OVRD_IN_LO, val); - pcie_phy_read(imx6_pcie, PCIE_PHY_ATEOVRD, &val); + pcie_phy_read(imx_pcie, PCIE_PHY_ATEOVRD, &val); val &= ~(PCIE_PHY_ATEOVRD_REF_CLKDIV_MASK << PCIE_PHY_ATEOVRD_REF_CLKDIV_SHIFT); val |= div << PCIE_PHY_ATEOVRD_REF_CLKDIV_SHIFT; val |= PCIE_PHY_ATEOVRD_EN; - pcie_phy_write(imx6_pcie, PCIE_PHY_ATEOVRD, val); + pcie_phy_write(imx_pcie, PCIE_PHY_ATEOVRD, val); return 0; } -static void imx6_pcie_reset_phy(struct imx6_pcie *imx6_pcie) +static void imx_pcie_reset_phy(struct imx_pcie *imx_pcie) { u16 tmp; - if (!(imx6_pcie->drvdata->flags & IMX6_PCIE_FLAG_IMX6_PHY)) + if (!(imx_pcie->drvdata->flags & IMX_PCIE_FLAG_IMX_PHY)) return; - pcie_phy_read(imx6_pcie, PHY_RX_OVRD_IN_LO, &tmp); + pcie_phy_read(imx_pcie, PHY_RX_OVRD_IN_LO, &tmp); tmp |= (PHY_RX_OVRD_IN_LO_RX_DATA_EN | PHY_RX_OVRD_IN_LO_RX_PLL_EN); - pcie_phy_write(imx6_pcie, PHY_RX_OVRD_IN_LO, tmp); + pcie_phy_write(imx_pcie, PHY_RX_OVRD_IN_LO, tmp); usleep_range(2000, 3000); - pcie_phy_read(imx6_pcie, PHY_RX_OVRD_IN_LO, &tmp); + pcie_phy_read(imx_pcie, PHY_RX_OVRD_IN_LO, &tmp); tmp &= ~(PHY_RX_OVRD_IN_LO_RX_DATA_EN | PHY_RX_OVRD_IN_LO_RX_PLL_EN); - pcie_phy_write(imx6_pcie, PHY_RX_OVRD_IN_LO, tmp); + pcie_phy_write(imx_pcie, PHY_RX_OVRD_IN_LO, tmp); } #ifdef CONFIG_ARM @@ -545,22 +545,22 @@ static int imx6q_pcie_abort_handler(unsigned long addr, } #endif -static int imx6_pcie_attach_pd(struct device *dev) +static int imx_pcie_attach_pd(struct device *dev) { - struct imx6_pcie *imx6_pcie = dev_get_drvdata(dev); + struct imx_pcie *imx_pcie = dev_get_drvdata(dev); struct device_link *link; /* Do nothing when in a single power domain */ if (dev->pm_domain) return 0; - imx6_pcie->pd_pcie = dev_pm_domain_attach_by_name(dev, "pcie"); - if (IS_ERR(imx6_pcie->pd_pcie)) - return PTR_ERR(imx6_pcie->pd_pcie); + imx_pcie->pd_pcie = dev_pm_domain_attach_by_name(dev, "pcie"); + if (IS_ERR(imx_pcie->pd_pcie)) + return PTR_ERR(imx_pcie->pd_pcie); /* Do nothing when power domain missing */ - if (!imx6_pcie->pd_pcie) + if (!imx_pcie->pd_pcie) return 0; - link = device_link_add(dev, imx6_pcie->pd_pcie, + link = device_link_add(dev, imx_pcie->pd_pcie, DL_FLAG_STATELESS | DL_FLAG_PM_RUNTIME | DL_FLAG_RPM_ACTIVE); @@ -569,11 +569,11 @@ static int imx6_pcie_attach_pd(struct device *dev) return -EINVAL; } - imx6_pcie->pd_pcie_phy = dev_pm_domain_attach_by_name(dev, "pcie_phy"); - if (IS_ERR(imx6_pcie->pd_pcie_phy)) - return PTR_ERR(imx6_pcie->pd_pcie_phy); + imx_pcie->pd_pcie_phy = dev_pm_domain_attach_by_name(dev, "pcie_phy"); + if (IS_ERR(imx_pcie->pd_pcie_phy)) + return PTR_ERR(imx_pcie->pd_pcie_phy); - link = device_link_add(dev, imx6_pcie->pd_pcie_phy, + link = device_link_add(dev, imx_pcie->pd_pcie_phy, DL_FLAG_STATELESS | DL_FLAG_PM_RUNTIME | DL_FLAG_RPM_ACTIVE); @@ -585,20 +585,20 @@ static int imx6_pcie_attach_pd(struct device *dev) return 0; } -static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie) +static int imx_pcie_enable_ref_clk(struct imx_pcie *imx_pcie) { unsigned int offset; int ret = 0; - switch (imx6_pcie->drvdata->variant) { + switch (imx_pcie->drvdata->variant) { case IMX6SX: - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX6SX_GPR12_PCIE_TEST_POWERDOWN, 0); break; case IMX6QP: case IMX6Q: /* power up core phy and enable ref clock */ - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, IMX6Q_GPR1_PCIE_TEST_PD, 0 << 18); /* * the async reset input need ref clock to sync internally, @@ -607,7 +607,7 @@ static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie) * add one ~10us delay here. */ usleep_range(10, 100); - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, IMX6Q_GPR1_PCIE_REF_CLK_EN, 1 << 16); break; case IMX7D: @@ -620,15 +620,15 @@ static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie) case IMX8MQ_EP: case IMX8MP: case IMX8MP_EP: - offset = imx6_pcie_grp_offset(imx6_pcie); + offset = imx_pcie_grp_offset(imx_pcie); /* * Set the over ride low and enabled * make sure that REF_CLK is turned on. */ - regmap_update_bits(imx6_pcie->iomuxc_gpr, offset, + regmap_update_bits(imx_pcie->iomuxc_gpr, offset, IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE, 0); - regmap_update_bits(imx6_pcie->iomuxc_gpr, offset, + regmap_update_bits(imx_pcie->iomuxc_gpr, offset, IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE_EN, IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE_EN); break; @@ -637,19 +637,19 @@ static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie) return ret; } -static void imx6_pcie_disable_ref_clk(struct imx6_pcie *imx6_pcie) +static void imx_pcie_disable_ref_clk(struct imx_pcie *imx_pcie) { - switch (imx6_pcie->drvdata->variant) { + switch (imx_pcie->drvdata->variant) { case IMX6QP: case IMX6Q: - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, IMX6Q_GPR1_PCIE_REF_CLK_EN, 0); - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, IMX6Q_GPR1_PCIE_TEST_PD, IMX6Q_GPR1_PCIE_TEST_PD); break; case IMX7D: - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX7D_GPR12_PCIE_PHY_REFCLK_SEL, IMX7D_GPR12_PCIE_PHY_REFCLK_SEL); break; @@ -658,17 +658,17 @@ static void imx6_pcie_disable_ref_clk(struct imx6_pcie *imx6_pcie) } } -static int imx6_pcie_clk_enable(struct imx6_pcie *imx6_pcie) +static int imx_pcie_clk_enable(struct imx_pcie *imx_pcie) { - struct dw_pcie *pci = imx6_pcie->pci; + struct dw_pcie *pci = imx_pcie->pci; struct device *dev = pci->dev; int ret; - ret = clk_bulk_prepare_enable(imx6_pcie->drvdata->clks_cnt, imx6_pcie->clks); + ret = clk_bulk_prepare_enable(imx_pcie->drvdata->clks_cnt, imx_pcie->clks); if (ret) return ret; - ret = imx6_pcie_enable_ref_clk(imx6_pcie); + ret = imx_pcie_enable_ref_clk(imx_pcie); if (ret) { dev_err(dev, "unable to enable pcie ref clock\n"); goto err_ref_clk; @@ -679,41 +679,41 @@ static int imx6_pcie_clk_enable(struct imx6_pcie *imx6_pcie) return 0; err_ref_clk: - clk_bulk_disable_unprepare(imx6_pcie->drvdata->clks_cnt, imx6_pcie->clks); + clk_bulk_disable_unprepare(imx_pcie->drvdata->clks_cnt, imx_pcie->clks); return ret; } -static void imx6_pcie_clk_disable(struct imx6_pcie *imx6_pcie) +static void imx_pcie_clk_disable(struct imx_pcie *imx_pcie) { - imx6_pcie_disable_ref_clk(imx6_pcie); - clk_bulk_disable_unprepare(imx6_pcie->drvdata->clks_cnt, imx6_pcie->clks); + imx_pcie_disable_ref_clk(imx_pcie); + clk_bulk_disable_unprepare(imx_pcie->drvdata->clks_cnt, imx_pcie->clks); } -static void imx6_pcie_assert_core_reset(struct imx6_pcie *imx6_pcie) +static void imx_pcie_assert_core_reset(struct imx_pcie *imx_pcie) { - reset_control_assert(imx6_pcie->pciephy_reset); - reset_control_assert(imx6_pcie->apps_reset); + reset_control_assert(imx_pcie->pciephy_reset); + reset_control_assert(imx_pcie->apps_reset); - switch (imx6_pcie->drvdata->variant) { + switch (imx_pcie->drvdata->variant) { case IMX6SX: - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX6SX_GPR12_PCIE_TEST_POWERDOWN, IMX6SX_GPR12_PCIE_TEST_POWERDOWN); /* Force PCIe PHY reset */ - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR5, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR5, IMX6SX_GPR5_PCIE_BTNRST_RESET, IMX6SX_GPR5_PCIE_BTNRST_RESET); break; case IMX6QP: - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, IMX6Q_GPR1_PCIE_SW_RST, IMX6Q_GPR1_PCIE_SW_RST); break; case IMX6Q: - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, IMX6Q_GPR1_PCIE_TEST_PD, 1 << 18); - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, IMX6Q_GPR1_PCIE_REF_CLK_EN, 0 << 16); break; default: @@ -721,47 +721,47 @@ static void imx6_pcie_assert_core_reset(struct imx6_pcie *imx6_pcie) } /* Some boards don't have PCIe reset GPIO. */ - if (gpio_is_valid(imx6_pcie->reset_gpio)) - gpio_set_value_cansleep(imx6_pcie->reset_gpio, - imx6_pcie->gpio_active_high); + if (gpio_is_valid(imx_pcie->reset_gpio)) + gpio_set_value_cansleep(imx_pcie->reset_gpio, + imx_pcie->gpio_active_high); } -static int imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie) +static int imx_pcie_deassert_core_reset(struct imx_pcie *imx_pcie) { - struct dw_pcie *pci = imx6_pcie->pci; + struct dw_pcie *pci = imx_pcie->pci; struct device *dev = pci->dev; - reset_control_deassert(imx6_pcie->pciephy_reset); + reset_control_deassert(imx_pcie->pciephy_reset); - switch (imx6_pcie->drvdata->variant) { + switch (imx_pcie->drvdata->variant) { case IMX7D: /* Workaround for ERR010728, failure of PCI-e PLL VCO to * oscillate, especially when cold. This turns off "Duty-cycle * Corrector" and other mysterious undocumented things. */ - if (likely(imx6_pcie->phy_base)) { + if (likely(imx_pcie->phy_base)) { /* De-assert DCC_FB_EN */ writel(PCIE_PHY_CMN_REG4_DCC_FB_EN, - imx6_pcie->phy_base + PCIE_PHY_CMN_REG4); + imx_pcie->phy_base + PCIE_PHY_CMN_REG4); /* Assert RX_EQS and RX_EQS_SEL */ writel(PCIE_PHY_CMN_REG24_RX_EQ_SEL | PCIE_PHY_CMN_REG24_RX_EQ, - imx6_pcie->phy_base + PCIE_PHY_CMN_REG24); + imx_pcie->phy_base + PCIE_PHY_CMN_REG24); /* Assert ATT_MODE */ writel(PCIE_PHY_CMN_REG26_ATT_MODE, - imx6_pcie->phy_base + PCIE_PHY_CMN_REG26); + imx_pcie->phy_base + PCIE_PHY_CMN_REG26); } else { dev_warn(dev, "Unable to apply ERR010728 workaround. DT missing fsl,imx7d-pcie-phy phandle ?\n"); } - imx7d_pcie_wait_for_phy_pll_lock(imx6_pcie); + imx7d_pcie_wait_for_phy_pll_lock(imx_pcie); break; case IMX6SX: - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR5, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR5, IMX6SX_GPR5_PCIE_BTNRST_RESET, 0); break; case IMX6QP: - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, IMX6Q_GPR1_PCIE_SW_RST, 0); usleep_range(200, 500); @@ -771,10 +771,10 @@ static int imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie) } /* Some boards don't have PCIe reset GPIO. */ - if (gpio_is_valid(imx6_pcie->reset_gpio)) { + if (gpio_is_valid(imx_pcie->reset_gpio)) { msleep(100); - gpio_set_value_cansleep(imx6_pcie->reset_gpio, - !imx6_pcie->gpio_active_high); + gpio_set_value_cansleep(imx_pcie->reset_gpio, + !imx_pcie->gpio_active_high); /* Wait for 100ms after PERST# deassertion (PCIe r5.0, 6.6.1) */ msleep(100); } @@ -782,9 +782,9 @@ static int imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie) return 0; } -static int imx6_pcie_wait_for_speed_change(struct imx6_pcie *imx6_pcie) +static int imx_pcie_wait_for_speed_change(struct imx_pcie *imx_pcie) { - struct dw_pcie *pci = imx6_pcie->pci; + struct dw_pcie *pci = imx_pcie->pci; struct device *dev = pci->dev; u32 tmp; unsigned int retries; @@ -801,33 +801,33 @@ static int imx6_pcie_wait_for_speed_change(struct imx6_pcie *imx6_pcie) return -ETIMEDOUT; } -static void imx6_pcie_ltssm_enable(struct device *dev) +static void imx_pcie_ltssm_enable(struct device *dev) { - struct imx6_pcie *imx6_pcie = dev_get_drvdata(dev); - const struct imx6_pcie_drvdata *drvdata = imx6_pcie->drvdata; + struct imx_pcie *imx_pcie = dev_get_drvdata(dev); + const struct imx_pcie_drvdata *drvdata = imx_pcie->drvdata; if (drvdata->ltssm_mask) - regmap_update_bits(imx6_pcie->iomuxc_gpr, drvdata->ltssm_off, drvdata->ltssm_mask, + regmap_update_bits(imx_pcie->iomuxc_gpr, drvdata->ltssm_off, drvdata->ltssm_mask, drvdata->ltssm_mask); - reset_control_deassert(imx6_pcie->apps_reset); + reset_control_deassert(imx_pcie->apps_reset); } -static void imx6_pcie_ltssm_disable(struct device *dev) +static void imx_pcie_ltssm_disable(struct device *dev) { - struct imx6_pcie *imx6_pcie = dev_get_drvdata(dev); - const struct imx6_pcie_drvdata *drvdata = imx6_pcie->drvdata; + struct imx_pcie *imx_pcie = dev_get_drvdata(dev); + const struct imx_pcie_drvdata *drvdata = imx_pcie->drvdata; if (drvdata->ltssm_mask) - regmap_update_bits(imx6_pcie->iomuxc_gpr, drvdata->ltssm_off, + regmap_update_bits(imx_pcie->iomuxc_gpr, drvdata->ltssm_off, drvdata->ltssm_mask, 0); - reset_control_assert(imx6_pcie->apps_reset); + reset_control_assert(imx_pcie->apps_reset); } -static int imx6_pcie_start_link(struct dw_pcie *pci) +static int imx_pcie_start_link(struct dw_pcie *pci) { - struct imx6_pcie *imx6_pcie = to_imx6_pcie(pci); + struct imx_pcie *imx_pcie = to_imx_pcie(pci); struct device *dev = pci->dev; u8 offset = dw_pcie_find_capability(pci, PCI_CAP_ID_EXP); u32 tmp; @@ -846,7 +846,7 @@ static int imx6_pcie_start_link(struct dw_pcie *pci) dw_pcie_dbi_ro_wr_dis(pci); /* Start LTSSM. */ - imx6_pcie_ltssm_enable(dev); + imx_pcie_ltssm_enable(dev); ret = dw_pcie_wait_for_link(pci); if (ret) @@ -869,8 +869,8 @@ static int imx6_pcie_start_link(struct dw_pcie *pci) dw_pcie_writel_dbi(pci, PCIE_LINK_WIDTH_SPEED_CONTROL, tmp); dw_pcie_dbi_ro_wr_dis(pci); - if (imx6_pcie->drvdata->flags & - IMX6_PCIE_FLAG_IMX6_SPEED_CHANGE) { + if (imx_pcie->drvdata->flags & + IMX_PCIE_FLAG_IMX_SPEED_CHANGE) { /* * On i.MX7, DIRECT_SPEED_CHANGE behaves differently * from i.MX6 family when no link speed transition @@ -880,7 +880,7 @@ static int imx6_pcie_start_link(struct dw_pcie *pci) * failure. */ - ret = imx6_pcie_wait_for_speed_change(imx6_pcie); + ret = imx_pcie_wait_for_speed_change(imx_pcie); if (ret) { dev_err(dev, "Failed to bring link up!\n"); goto err_reset_phy; @@ -895,37 +895,37 @@ static int imx6_pcie_start_link(struct dw_pcie *pci) dev_info(dev, "Link: Only Gen1 is enabled\n"); } - imx6_pcie->link_is_up = true; + imx_pcie->link_is_up = true; tmp = dw_pcie_readw_dbi(pci, offset + PCI_EXP_LNKSTA); dev_info(dev, "Link up, Gen%i\n", tmp & PCI_EXP_LNKSTA_CLS); return 0; err_reset_phy: - imx6_pcie->link_is_up = false; + imx_pcie->link_is_up = false; dev_dbg(dev, "PHY DEBUG_R0=0x%08x DEBUG_R1=0x%08x\n", dw_pcie_readl_dbi(pci, PCIE_PORT_DEBUG0), dw_pcie_readl_dbi(pci, PCIE_PORT_DEBUG1)); - imx6_pcie_reset_phy(imx6_pcie); + imx_pcie_reset_phy(imx_pcie); return 0; } -static void imx6_pcie_stop_link(struct dw_pcie *pci) +static void imx_pcie_stop_link(struct dw_pcie *pci) { struct device *dev = pci->dev; /* Turn off PCIe LTSSM */ - imx6_pcie_ltssm_disable(dev); + imx_pcie_ltssm_disable(dev); } -static int imx6_pcie_host_init(struct dw_pcie_rp *pp) +static int imx_pcie_host_init(struct dw_pcie_rp *pp) { struct dw_pcie *pci = to_dw_pcie_from_pp(pp); struct device *dev = pci->dev; - struct imx6_pcie *imx6_pcie = to_imx6_pcie(pci); + struct imx_pcie *imx_pcie = to_imx_pcie(pci); int ret; - if (imx6_pcie->vpcie) { - ret = regulator_enable(imx6_pcie->vpcie); + if (imx_pcie->vpcie) { + ret = regulator_enable(imx_pcie->vpcie); if (ret) { dev_err(dev, "failed to enable vpcie regulator: %d\n", ret); @@ -933,83 +933,83 @@ static int imx6_pcie_host_init(struct dw_pcie_rp *pp) } } - imx6_pcie_assert_core_reset(imx6_pcie); + imx_pcie_assert_core_reset(imx_pcie); - if (imx6_pcie->drvdata->init_phy) - imx6_pcie->drvdata->init_phy(imx6_pcie); + if (imx_pcie->drvdata->init_phy) + imx_pcie->drvdata->init_phy(imx_pcie); - imx6_pcie_configure_type(imx6_pcie); + imx_pcie_configure_type(imx_pcie); - ret = imx6_pcie_clk_enable(imx6_pcie); + ret = imx_pcie_clk_enable(imx_pcie); if (ret) { dev_err(dev, "unable to enable pcie clocks: %d\n", ret); goto err_reg_disable; } - if (imx6_pcie->phy) { - ret = phy_init(imx6_pcie->phy); + if (imx_pcie->phy) { + ret = phy_init(imx_pcie->phy); if (ret) { dev_err(dev, "pcie PHY power up failed\n"); goto err_clk_disable; } } - if (imx6_pcie->phy) { - ret = phy_power_on(imx6_pcie->phy); + if (imx_pcie->phy) { + ret = phy_power_on(imx_pcie->phy); if (ret) { dev_err(dev, "waiting for PHY ready timeout!\n"); goto err_phy_off; } } - ret = imx6_pcie_deassert_core_reset(imx6_pcie); + ret = imx_pcie_deassert_core_reset(imx_pcie); if (ret < 0) { dev_err(dev, "pcie deassert core reset failed: %d\n", ret); goto err_phy_off; } - imx6_setup_phy_mpll(imx6_pcie); + imx_setup_phy_mpll(imx_pcie); return 0; err_phy_off: - if (imx6_pcie->phy) - phy_exit(imx6_pcie->phy); + if (imx_pcie->phy) + phy_exit(imx_pcie->phy); err_clk_disable: - imx6_pcie_clk_disable(imx6_pcie); + imx_pcie_clk_disable(imx_pcie); err_reg_disable: - if (imx6_pcie->vpcie) - regulator_disable(imx6_pcie->vpcie); + if (imx_pcie->vpcie) + regulator_disable(imx_pcie->vpcie); return ret; } -static void imx6_pcie_host_exit(struct dw_pcie_rp *pp) +static void imx_pcie_host_exit(struct dw_pcie_rp *pp) { struct dw_pcie *pci = to_dw_pcie_from_pp(pp); - struct imx6_pcie *imx6_pcie = to_imx6_pcie(pci); + struct imx_pcie *imx_pcie = to_imx_pcie(pci); - if (imx6_pcie->phy) { - if (phy_power_off(imx6_pcie->phy)) + if (imx_pcie->phy) { + if (phy_power_off(imx_pcie->phy)) dev_err(pci->dev, "unable to power off PHY\n"); - phy_exit(imx6_pcie->phy); + phy_exit(imx_pcie->phy); } - imx6_pcie_clk_disable(imx6_pcie); + imx_pcie_clk_disable(imx_pcie); - if (imx6_pcie->vpcie) - regulator_disable(imx6_pcie->vpcie); + if (imx_pcie->vpcie) + regulator_disable(imx_pcie->vpcie); } -static const struct dw_pcie_host_ops imx6_pcie_host_ops = { - .init = imx6_pcie_host_init, - .deinit = imx6_pcie_host_exit, +static const struct dw_pcie_host_ops imx_pcie_host_ops = { + .init = imx_pcie_host_init, + .deinit = imx_pcie_host_exit, }; static const struct dw_pcie_ops dw_pcie_ops = { - .start_link = imx6_pcie_start_link, - .stop_link = imx6_pcie_stop_link, + .start_link = imx_pcie_start_link, + .stop_link = imx_pcie_stop_link, }; -static void imx6_pcie_ep_init(struct dw_pcie_ep *ep) +static void imx_pcie_ep_init(struct dw_pcie_ep *ep) { enum pci_barno bar; struct dw_pcie *pci = to_dw_pcie_from_ep(ep); @@ -1018,7 +1018,7 @@ static void imx6_pcie_ep_init(struct dw_pcie_ep *ep) dw_pcie_ep_reset_bar(pci, bar); } -static int imx6_pcie_ep_raise_irq(struct dw_pcie_ep *ep, u8 func_no, +static int imx_pcie_ep_raise_irq(struct dw_pcie_ep *ep, u8 func_no, unsigned int type, u16 interrupt_num) { struct dw_pcie *pci = to_dw_pcie_from_ep(ep); @@ -1065,35 +1065,35 @@ static const struct pci_epc_features imx95_pcie_epc_features = { }; static const struct pci_epc_features* -imx6_pcie_ep_get_features(struct dw_pcie_ep *ep) +imx_pcie_ep_get_features(struct dw_pcie_ep *ep) { struct dw_pcie *pci = to_dw_pcie_from_ep(ep); - struct imx6_pcie *imx6_pcie = to_imx6_pcie(pci); + struct imx_pcie *imx_pcie = to_imx_pcie(pci); - return imx6_pcie->drvdata->epc_features; + return imx_pcie->drvdata->epc_features; } static const struct dw_pcie_ep_ops pcie_ep_ops = { - .init = imx6_pcie_ep_init, - .raise_irq = imx6_pcie_ep_raise_irq, - .get_features = imx6_pcie_ep_get_features, + .init = imx_pcie_ep_init, + .raise_irq = imx_pcie_ep_raise_irq, + .get_features = imx_pcie_ep_get_features, }; -static int imx6_add_pcie_ep(struct imx6_pcie *imx6_pcie, +static int imx_add_pcie_ep(struct imx_pcie *imx_pcie, struct platform_device *pdev) { int ret; unsigned int pcie_dbi2_offset; struct dw_pcie_ep *ep; - struct dw_pcie *pci = imx6_pcie->pci; + struct dw_pcie *pci = imx_pcie->pci; struct dw_pcie_rp *pp = &pci->pp; struct device *dev = pci->dev; - imx6_pcie_host_init(pp); + imx_pcie_host_init(pp); ep = &pci->ep; ep->ops = &pcie_ep_ops; - switch (imx6_pcie->drvdata->variant) { + switch (imx_pcie->drvdata->variant) { case IMX8MQ_EP: case IMX8MM_EP: case IMX8MP_EP: @@ -1115,7 +1115,7 @@ static int imx6_add_pcie_ep(struct imx6_pcie *imx6_pcie, if (device_property_match_string(dev, "reg-names", "dbi2") >= 0) pci->dbi_base2 = NULL; - if (imx6_check_flag(imx6_pcie, IMX6_PCIE_FLAG_SUPPORT_64BIT)) + if (imx_check_flag(imx_pcie, IMX_PCIE_FLAG_SUPPORT_64BIT)) dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64)); ret = dw_pcie_ep_init(ep); @@ -1124,30 +1124,30 @@ static int imx6_add_pcie_ep(struct imx6_pcie *imx6_pcie, return ret; } /* Start LTSSM. */ - imx6_pcie_ltssm_enable(dev); + imx_pcie_ltssm_enable(dev); return 0; } -static void imx6_pcie_pm_turnoff(struct imx6_pcie *imx6_pcie) +static void imx_pcie_pm_turnoff(struct imx_pcie *imx_pcie) { - struct device *dev = imx6_pcie->pci->dev; + struct device *dev = imx_pcie->pci->dev; /* Some variants have a turnoff reset in DT */ - if (imx6_pcie->turnoff_reset) { - reset_control_assert(imx6_pcie->turnoff_reset); - reset_control_deassert(imx6_pcie->turnoff_reset); + if (imx_pcie->turnoff_reset) { + reset_control_assert(imx_pcie->turnoff_reset); + reset_control_deassert(imx_pcie->turnoff_reset); goto pm_turnoff_sleep; } /* Others poke directly at IOMUXC registers */ - switch (imx6_pcie->drvdata->variant) { + switch (imx_pcie->drvdata->variant) { case IMX6SX: case IMX6QP: - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX6SX_GPR12_PCIE_PM_TURN_OFF, IMX6SX_GPR12_PCIE_PM_TURN_OFF); - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX6SX_GPR12_PCIE_PM_TURN_OFF, 0); break; default: @@ -1166,73 +1166,73 @@ static void imx6_pcie_pm_turnoff(struct imx6_pcie *imx6_pcie) usleep_range(1000, 10000); } -static void imx6_pcie_msi_save_restore(struct imx6_pcie *imx6_pcie, bool save) +static void imx_pcie_msi_save_restore(struct imx_pcie *imx_pcie, bool save) { u8 offset; u16 val; - struct dw_pcie *pci = imx6_pcie->pci; + struct dw_pcie *pci = imx_pcie->pci; if (pci_msi_enabled()) { offset = dw_pcie_find_capability(pci, PCI_CAP_ID_MSI); if (save) { val = dw_pcie_readw_dbi(pci, offset + PCI_MSI_FLAGS); - imx6_pcie->msi_ctrl = val; + imx_pcie->msi_ctrl = val; } else { dw_pcie_dbi_ro_wr_en(pci); - val = imx6_pcie->msi_ctrl; + val = imx_pcie->msi_ctrl; dw_pcie_writew_dbi(pci, offset + PCI_MSI_FLAGS, val); dw_pcie_dbi_ro_wr_dis(pci); } } } -static int imx6_pcie_suspend_noirq(struct device *dev) +static int imx_pcie_suspend_noirq(struct device *dev) { - struct imx6_pcie *imx6_pcie = dev_get_drvdata(dev); - struct dw_pcie_rp *pp = &imx6_pcie->pci->pp; + struct imx_pcie *imx_pcie = dev_get_drvdata(dev); + struct dw_pcie_rp *pp = &imx_pcie->pci->pp; - if (!(imx6_pcie->drvdata->flags & IMX6_PCIE_FLAG_SUPPORTS_SUSPEND)) + if (!(imx_pcie->drvdata->flags & IMX_PCIE_FLAG_SUPPORTS_SUSPEND)) return 0; - imx6_pcie_msi_save_restore(imx6_pcie, true); - imx6_pcie_pm_turnoff(imx6_pcie); - imx6_pcie_stop_link(imx6_pcie->pci); - imx6_pcie_host_exit(pp); + imx_pcie_msi_save_restore(imx_pcie, true); + imx_pcie_pm_turnoff(imx_pcie); + imx_pcie_stop_link(imx_pcie->pci); + imx_pcie_host_exit(pp); return 0; } -static int imx6_pcie_resume_noirq(struct device *dev) +static int imx_pcie_resume_noirq(struct device *dev) { int ret; - struct imx6_pcie *imx6_pcie = dev_get_drvdata(dev); - struct dw_pcie_rp *pp = &imx6_pcie->pci->pp; + struct imx_pcie *imx_pcie = dev_get_drvdata(dev); + struct dw_pcie_rp *pp = &imx_pcie->pci->pp; - if (!(imx6_pcie->drvdata->flags & IMX6_PCIE_FLAG_SUPPORTS_SUSPEND)) + if (!(imx_pcie->drvdata->flags & IMX_PCIE_FLAG_SUPPORTS_SUSPEND)) return 0; - ret = imx6_pcie_host_init(pp); + ret = imx_pcie_host_init(pp); if (ret) return ret; - imx6_pcie_msi_save_restore(imx6_pcie, false); + imx_pcie_msi_save_restore(imx_pcie, false); dw_pcie_setup_rc(pp); - if (imx6_pcie->link_is_up) - imx6_pcie_start_link(imx6_pcie->pci); + if (imx_pcie->link_is_up) + imx_pcie_start_link(imx_pcie->pci); return 0; } -static const struct dev_pm_ops imx6_pcie_pm_ops = { - NOIRQ_SYSTEM_SLEEP_PM_OPS(imx6_pcie_suspend_noirq, - imx6_pcie_resume_noirq) +static const struct dev_pm_ops imx_pcie_pm_ops = { + NOIRQ_SYSTEM_SLEEP_PM_OPS(imx_pcie_suspend_noirq, + imx_pcie_resume_noirq) }; -static int imx6_pcie_probe(struct platform_device *pdev) +static int imx_pcie_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct dw_pcie *pci; - struct imx6_pcie *imx6_pcie; + struct imx_pcie *imx_pcie; struct device_node *np; struct resource *dbi_base; struct device_node *node = dev->of_node; @@ -1240,8 +1240,8 @@ static int imx6_pcie_probe(struct platform_device *pdev) u16 val; int i; - imx6_pcie = devm_kzalloc(dev, sizeof(*imx6_pcie), GFP_KERNEL); - if (!imx6_pcie) + imx_pcie = devm_kzalloc(dev, sizeof(*imx_pcie), GFP_KERNEL); + if (!imx_pcie) return -ENOMEM; pci = devm_kzalloc(dev, sizeof(*pci), GFP_KERNEL); @@ -1250,10 +1250,10 @@ static int imx6_pcie_probe(struct platform_device *pdev) pci->dev = dev; pci->ops = &dw_pcie_ops; - pci->pp.ops = &imx6_pcie_host_ops; + pci->pp.ops = &imx_pcie_host_ops; - imx6_pcie->pci = pci; - imx6_pcie->drvdata = of_device_get_match_data(dev); + imx_pcie->pci = pci; + imx_pcie->drvdata = of_device_get_match_data(dev); /* Find the PHY if one is defined, only imx7d uses it */ np = of_parse_phandle(node, "fsl,imx7d-pcie-phy", 0); @@ -1265,9 +1265,9 @@ static int imx6_pcie_probe(struct platform_device *pdev) dev_err(dev, "Unable to map PCIe PHY\n"); return ret; } - imx6_pcie->phy_base = devm_ioremap_resource(dev, &res); - if (IS_ERR(imx6_pcie->phy_base)) - return PTR_ERR(imx6_pcie->phy_base); + imx_pcie->phy_base = devm_ioremap_resource(dev, &res); + if (IS_ERR(imx_pcie->phy_base)) + return PTR_ERR(imx_pcie->phy_base); } pci->dbi_base = devm_platform_get_and_ioremap_resource(pdev, 0, &dbi_base); @@ -1275,12 +1275,12 @@ static int imx6_pcie_probe(struct platform_device *pdev) return PTR_ERR(pci->dbi_base); /* Fetch GPIOs */ - imx6_pcie->reset_gpio = of_get_named_gpio(node, "reset-gpio", 0); - imx6_pcie->gpio_active_high = of_property_read_bool(node, + imx_pcie->reset_gpio = of_get_named_gpio(node, "reset-gpio", 0); + imx_pcie->gpio_active_high = of_property_read_bool(node, "reset-gpio-active-high"); - if (gpio_is_valid(imx6_pcie->reset_gpio)) { - ret = devm_gpio_request_one(dev, imx6_pcie->reset_gpio, - imx6_pcie->gpio_active_high ? + if (gpio_is_valid(imx_pcie->reset_gpio)) { + ret = devm_gpio_request_one(dev, imx_pcie->reset_gpio, + imx_pcie->gpio_active_high ? GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW, "PCIe reset"); @@ -1288,69 +1288,69 @@ static int imx6_pcie_probe(struct platform_device *pdev) dev_err(dev, "unable to get reset gpio\n"); return ret; } - } else if (imx6_pcie->reset_gpio == -EPROBE_DEFER) { - return imx6_pcie->reset_gpio; + } else if (imx_pcie->reset_gpio == -EPROBE_DEFER) { + return imx_pcie->reset_gpio; } - if (imx6_pcie->drvdata->clks_cnt >= IMX6_PCIE_MAX_CLKS) + if (imx_pcie->drvdata->clks_cnt >= IMX_PCIE_MAX_CLKS) return dev_err_probe(dev, -ENOMEM, "clks_cnt is too big\n"); - for (i = 0; i < imx6_pcie->drvdata->clks_cnt; i++) - imx6_pcie->clks[i].id = imx6_pcie->drvdata->clk_names[i]; + for (i = 0; i < imx_pcie->drvdata->clks_cnt; i++) + imx_pcie->clks[i].id = imx_pcie->drvdata->clk_names[i]; /* Fetch clocks */ - ret = devm_clk_bulk_get(dev, imx6_pcie->drvdata->clks_cnt, imx6_pcie->clks); + ret = devm_clk_bulk_get(dev, imx_pcie->drvdata->clks_cnt, imx_pcie->clks); if (ret) return ret; - if (imx6_check_flag(imx6_pcie, IMX6_PCIE_FLAG_HAS_PHYDRV)) { - imx6_pcie->phy = devm_phy_get(dev, "pcie-phy"); - if (IS_ERR(imx6_pcie->phy)) - return dev_err_probe(dev, PTR_ERR(imx6_pcie->phy), + if (imx_check_flag(imx_pcie, IMX_PCIE_FLAG_HAS_PHYDRV)) { + imx_pcie->phy = devm_phy_get(dev, "pcie-phy"); + if (IS_ERR(imx_pcie->phy)) + return dev_err_probe(dev, PTR_ERR(imx_pcie->phy), "failed to get pcie phy\n"); } - if (imx6_check_flag(imx6_pcie, IMX6_PCIE_FLAG_HAS_APP_RESET)) { - imx6_pcie->apps_reset = devm_reset_control_get_exclusive(dev, "apps"); - if (IS_ERR(imx6_pcie->apps_reset)) - return dev_err_probe(dev, PTR_ERR(imx6_pcie->apps_reset), + if (imx_check_flag(imx_pcie, IMX_PCIE_FLAG_HAS_APP_RESET)) { + imx_pcie->apps_reset = devm_reset_control_get_exclusive(dev, "apps"); + if (IS_ERR(imx_pcie->apps_reset)) + return dev_err_probe(dev, PTR_ERR(imx_pcie->apps_reset), "failed to get pcie apps reset control\n"); } - if (imx6_check_flag(imx6_pcie, IMX6_PCIE_FLAG_HAS_PHY_RESET)) { - imx6_pcie->pciephy_reset = devm_reset_control_get_exclusive(dev, "pciephy"); - if (IS_ERR(imx6_pcie->pciephy_reset)) - return dev_err_probe(dev, PTR_ERR(imx6_pcie->pciephy_reset), + if (imx_check_flag(imx_pcie, IMX_PCIE_FLAG_HAS_PHY_RESET)) { + imx_pcie->pciephy_reset = devm_reset_control_get_exclusive(dev, "pciephy"); + if (IS_ERR(imx_pcie->pciephy_reset)) + return dev_err_probe(dev, PTR_ERR(imx_pcie->pciephy_reset), "Failed to get PCIEPHY reset control\n"); } - switch (imx6_pcie->drvdata->variant) { + switch (imx_pcie->drvdata->variant) { case IMX8MQ: case IMX8MQ_EP: case IMX7D: if (dbi_base->start == IMX8MQ_PCIE2_BASE_ADDR) - imx6_pcie->controller_id = 1; + imx_pcie->controller_id = 1; default: break; } /* Grab turnoff reset */ - imx6_pcie->turnoff_reset = devm_reset_control_get_optional_exclusive(dev, "turnoff"); - if (IS_ERR(imx6_pcie->turnoff_reset)) { + imx_pcie->turnoff_reset = devm_reset_control_get_optional_exclusive(dev, "turnoff"); + if (IS_ERR(imx_pcie->turnoff_reset)) { dev_err(dev, "Failed to get TURNOFF reset control\n"); - return PTR_ERR(imx6_pcie->turnoff_reset); + return PTR_ERR(imx_pcie->turnoff_reset); } - if (imx6_pcie->drvdata->gpr) { + if (imx_pcie->drvdata->gpr) { /* Grab GPR config register range */ - imx6_pcie->iomuxc_gpr = - syscon_regmap_lookup_by_compatible(imx6_pcie->drvdata->gpr); - if (IS_ERR(imx6_pcie->iomuxc_gpr)) - return dev_err_probe(dev, PTR_ERR(imx6_pcie->iomuxc_gpr), + imx_pcie->iomuxc_gpr = + syscon_regmap_lookup_by_compatible(imx_pcie->drvdata->gpr); + if (IS_ERR(imx_pcie->iomuxc_gpr)) + return dev_err_probe(dev, PTR_ERR(imx_pcie->iomuxc_gpr), "unable to find iomuxc registers\n"); } - if (imx6_check_flag(imx6_pcie, IMX6_PCIE_FLAG_HAS_SERDES)) { + if (imx_check_flag(imx_pcie, IMX_PCIE_FLAG_HAS_SERDES)) { void __iomem *off = devm_platform_ioremap_resource_byname(pdev, "app"); if (IS_ERR(off)) @@ -1363,59 +1363,59 @@ static int imx6_pcie_probe(struct platform_device *pdev) .reg_stride = 4, }; - imx6_pcie->iomuxc_gpr = devm_regmap_init_mmio(dev, off, ®map_config); - if (IS_ERR(imx6_pcie->iomuxc_gpr)) - return dev_err_probe(dev, PTR_ERR(imx6_pcie->iomuxc_gpr), + imx_pcie->iomuxc_gpr = devm_regmap_init_mmio(dev, off, ®map_config); + if (IS_ERR(imx_pcie->iomuxc_gpr)) + return dev_err_probe(dev, PTR_ERR(imx_pcie->iomuxc_gpr), "unable to find iomuxc registers\n"); } /* Grab PCIe PHY Tx Settings */ if (of_property_read_u32(node, "fsl,tx-deemph-gen1", - &imx6_pcie->tx_deemph_gen1)) - imx6_pcie->tx_deemph_gen1 = 0; + &imx_pcie->tx_deemph_gen1)) + imx_pcie->tx_deemph_gen1 = 0; if (of_property_read_u32(node, "fsl,tx-deemph-gen2-3p5db", - &imx6_pcie->tx_deemph_gen2_3p5db)) - imx6_pcie->tx_deemph_gen2_3p5db = 0; + &imx_pcie->tx_deemph_gen2_3p5db)) + imx_pcie->tx_deemph_gen2_3p5db = 0; if (of_property_read_u32(node, "fsl,tx-deemph-gen2-6db", - &imx6_pcie->tx_deemph_gen2_6db)) - imx6_pcie->tx_deemph_gen2_6db = 20; + &imx_pcie->tx_deemph_gen2_6db)) + imx_pcie->tx_deemph_gen2_6db = 20; if (of_property_read_u32(node, "fsl,tx-swing-full", - &imx6_pcie->tx_swing_full)) - imx6_pcie->tx_swing_full = 127; + &imx_pcie->tx_swing_full)) + imx_pcie->tx_swing_full = 127; if (of_property_read_u32(node, "fsl,tx-swing-low", - &imx6_pcie->tx_swing_low)) - imx6_pcie->tx_swing_low = 127; + &imx_pcie->tx_swing_low)) + imx_pcie->tx_swing_low = 127; /* Limit link speed */ pci->link_gen = 1; of_property_read_u32(node, "fsl,max-link-speed", &pci->link_gen); - imx6_pcie->vpcie = devm_regulator_get_optional(&pdev->dev, "vpcie"); - if (IS_ERR(imx6_pcie->vpcie)) { - if (PTR_ERR(imx6_pcie->vpcie) != -ENODEV) - return PTR_ERR(imx6_pcie->vpcie); - imx6_pcie->vpcie = NULL; + imx_pcie->vpcie = devm_regulator_get_optional(&pdev->dev, "vpcie"); + if (IS_ERR(imx_pcie->vpcie)) { + if (PTR_ERR(imx_pcie->vpcie) != -ENODEV) + return PTR_ERR(imx_pcie->vpcie); + imx_pcie->vpcie = NULL; } - imx6_pcie->vph = devm_regulator_get_optional(&pdev->dev, "vph"); - if (IS_ERR(imx6_pcie->vph)) { - if (PTR_ERR(imx6_pcie->vph) != -ENODEV) - return PTR_ERR(imx6_pcie->vph); - imx6_pcie->vph = NULL; + imx_pcie->vph = devm_regulator_get_optional(&pdev->dev, "vph"); + if (IS_ERR(imx_pcie->vph)) { + if (PTR_ERR(imx_pcie->vph) != -ENODEV) + return PTR_ERR(imx_pcie->vph); + imx_pcie->vph = NULL; } - platform_set_drvdata(pdev, imx6_pcie); + platform_set_drvdata(pdev, imx_pcie); - ret = imx6_pcie_attach_pd(dev); + ret = imx_pcie_attach_pd(dev); if (ret) return ret; - if (imx6_pcie->drvdata->mode == DW_PCIE_EP_TYPE) { - ret = imx6_add_pcie_ep(imx6_pcie, pdev); + if (imx_pcie->drvdata->mode == DW_PCIE_EP_TYPE) { + ret = imx_add_pcie_ep(imx_pcie, pdev); if (ret < 0) return ret; } else { @@ -1435,12 +1435,12 @@ static int imx6_pcie_probe(struct platform_device *pdev) return 0; } -static void imx6_pcie_shutdown(struct platform_device *pdev) +static void imx_pcie_shutdown(struct platform_device *pdev) { - struct imx6_pcie *imx6_pcie = platform_get_drvdata(pdev); + struct imx_pcie *imx_pcie = platform_get_drvdata(pdev); /* bring down link, so bootloader gets clean state in case of reboot */ - imx6_pcie_assert_core_reset(imx6_pcie); + imx_pcie_assert_core_reset(imx_pcie); } static const char * const imx6q_clks[] = {"pcie_bus", "pcie", "pcie_phy"}; @@ -1448,11 +1448,11 @@ static const char * const imx8mm_clks[] = {"pcie_bus", "pcie", "pcie_aux"}; static const char * const imx8mq_clks[] = {"pcie_bus", "pcie", "pcie_phy", "pcie_aux"}; static const char * const imx6sx_clks[] = {"pcie_bus", "pcie", "pcie_phy", "pcie_inbound_axi"}; -static const struct imx6_pcie_drvdata drvdata[] = { +static const struct imx_pcie_drvdata drvdata[] = { [IMX6Q] = { .variant = IMX6Q, - .flags = IMX6_PCIE_FLAG_IMX6_PHY | - IMX6_PCIE_FLAG_IMX6_SPEED_CHANGE, + .flags = IMX_PCIE_FLAG_IMX_PHY | + IMX_PCIE_FLAG_IMX_SPEED_CHANGE, .dbi_length = 0x200, .gpr = "fsl,imx6q-iomuxc-gpr", .clk_names = imx6q_clks, @@ -1461,13 +1461,13 @@ static const struct imx6_pcie_drvdata drvdata[] = { .ltssm_mask = IMX6Q_GPR12_PCIE_CTL_2, .mode_off[0] = IOMUXC_GPR12, .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, - .init_phy = imx6_pcie_init_phy, + .init_phy = imx_pcie_init_phy, }, [IMX6SX] = { .variant = IMX6SX, - .flags = IMX6_PCIE_FLAG_IMX6_PHY | - IMX6_PCIE_FLAG_IMX6_SPEED_CHANGE | - IMX6_PCIE_FLAG_SUPPORTS_SUSPEND, + .flags = IMX_PCIE_FLAG_IMX_PHY | + IMX_PCIE_FLAG_IMX_SPEED_CHANGE | + IMX_PCIE_FLAG_SUPPORTS_SUSPEND, .gpr = "fsl,imx6q-iomuxc-gpr", .clk_names = imx6sx_clks, .clks_cnt = ARRAY_SIZE(imx6sx_clks), @@ -1479,9 +1479,9 @@ static const struct imx6_pcie_drvdata drvdata[] = { }, [IMX6QP] = { .variant = IMX6QP, - .flags = IMX6_PCIE_FLAG_IMX6_PHY | - IMX6_PCIE_FLAG_IMX6_SPEED_CHANGE | - IMX6_PCIE_FLAG_SUPPORTS_SUSPEND, + .flags = IMX_PCIE_FLAG_IMX_PHY | + IMX_PCIE_FLAG_IMX_SPEED_CHANGE | + IMX_PCIE_FLAG_SUPPORTS_SUSPEND, .dbi_length = 0x200, .gpr = "fsl,imx6q-iomuxc-gpr", .clk_names = imx6q_clks, @@ -1490,13 +1490,13 @@ static const struct imx6_pcie_drvdata drvdata[] = { .ltssm_mask = IMX6Q_GPR12_PCIE_CTL_2, .mode_off[0] = IOMUXC_GPR12, .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, - .init_phy = imx6_pcie_init_phy, + .init_phy = imx_pcie_init_phy, }, [IMX7D] = { .variant = IMX7D, - .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND | - IMX6_PCIE_FLAG_HAS_APP_RESET | - IMX6_PCIE_FLAG_HAS_PHY_RESET, + .flags = IMX_PCIE_FLAG_SUPPORTS_SUSPEND | + IMX_PCIE_FLAG_HAS_APP_RESET | + IMX_PCIE_FLAG_HAS_PHY_RESET, .gpr = "fsl,imx7d-iomuxc-gpr", .clk_names = imx6q_clks, .clks_cnt = ARRAY_SIZE(imx6q_clks), @@ -1506,8 +1506,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { }, [IMX8MQ] = { .variant = IMX8MQ, - .flags = IMX6_PCIE_FLAG_HAS_APP_RESET | - IMX6_PCIE_FLAG_HAS_PHY_RESET, + .flags = IMX_PCIE_FLAG_HAS_APP_RESET | + IMX_PCIE_FLAG_HAS_PHY_RESET, .gpr = "fsl,imx8mq-iomuxc-gpr", .clk_names = imx8mq_clks, .clks_cnt = ARRAY_SIZE(imx8mq_clks), @@ -1519,9 +1519,9 @@ static const struct imx6_pcie_drvdata drvdata[] = { }, [IMX8MM] = { .variant = IMX8MM, - .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND | - IMX6_PCIE_FLAG_HAS_PHYDRV | - IMX6_PCIE_FLAG_HAS_APP_RESET, + .flags = IMX_PCIE_FLAG_SUPPORTS_SUSPEND | + IMX_PCIE_FLAG_HAS_PHYDRV | + IMX_PCIE_FLAG_HAS_APP_RESET, .gpr = "fsl,imx8mm-iomuxc-gpr", .clk_names = imx8mm_clks, .clks_cnt = ARRAY_SIZE(imx8mm_clks), @@ -1530,9 +1530,9 @@ static const struct imx6_pcie_drvdata drvdata[] = { }, [IMX8MP] = { .variant = IMX8MP, - .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND | - IMX6_PCIE_FLAG_HAS_PHYDRV | - IMX6_PCIE_FLAG_HAS_APP_RESET, + .flags = IMX_PCIE_FLAG_SUPPORTS_SUSPEND | + IMX_PCIE_FLAG_HAS_PHYDRV | + IMX_PCIE_FLAG_HAS_APP_RESET, .gpr = "fsl,imx8mp-iomuxc-gpr", .clk_names = imx8mm_clks, .clks_cnt = ARRAY_SIZE(imx8mm_clks), @@ -1541,7 +1541,7 @@ static const struct imx6_pcie_drvdata drvdata[] = { }, [IMX95] = { .variant = IMX95, - .flags = IMX6_PCIE_FLAG_HAS_SERDES, + .flags = IMX_PCIE_FLAG_HAS_SERDES, .clk_names = imx8mq_clks, .clks_cnt = ARRAY_SIZE(imx8mq_clks), .ltssm_off = IMX95_PE0_GEN_CTRL_3, @@ -1552,8 +1552,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { }, [IMX8MQ_EP] = { .variant = IMX8MQ_EP, - .flags = IMX6_PCIE_FLAG_HAS_APP_RESET | - IMX6_PCIE_FLAG_HAS_PHY_RESET, + .flags = IMX_PCIE_FLAG_HAS_APP_RESET | + IMX_PCIE_FLAG_HAS_PHY_RESET, .mode = DW_PCIE_EP_TYPE, .gpr = "fsl,imx8mq-iomuxc-gpr", .clk_names = imx8mq_clks, @@ -1567,7 +1567,7 @@ static const struct imx6_pcie_drvdata drvdata[] = { }, [IMX8MM_EP] = { .variant = IMX8MM_EP, - .flags = IMX6_PCIE_FLAG_HAS_PHYDRV, + .flags = IMX_PCIE_FLAG_HAS_PHYDRV, .mode = DW_PCIE_EP_TYPE, .gpr = "fsl,imx8mm-iomuxc-gpr", .clk_names = imx8mm_clks, @@ -1578,7 +1578,7 @@ static const struct imx6_pcie_drvdata drvdata[] = { }, [IMX8MP_EP] = { .variant = IMX8MP_EP, - .flags = IMX6_PCIE_FLAG_HAS_PHYDRV, + .flags = IMX_PCIE_FLAG_HAS_PHYDRV, .mode = DW_PCIE_EP_TYPE, .gpr = "fsl,imx8mp-iomuxc-gpr", .clk_names = imx8mm_clks, @@ -1589,8 +1589,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { }, [IMX95_EP] = { .variant = IMX95_EP, - .flags = IMX6_PCIE_FLAG_HAS_SERDES | - IMX6_PCIE_FLAG_SUPPORT_64BIT, + .flags = IMX_PCIE_FLAG_HAS_SERDES | + IMX_PCIE_FLAG_SUPPORT_64BIT, .clk_names = imx8mq_clks, .clks_cnt = ARRAY_SIZE(imx8mq_clks), .ltssm_off = IMX95_PE0_GEN_CTRL_3, @@ -1603,7 +1603,7 @@ static const struct imx6_pcie_drvdata drvdata[] = { }, }; -static const struct of_device_id imx6_pcie_of_match[] = { +static const struct of_device_id imx_pcie_of_match[] = { { .compatible = "fsl,imx6q-pcie", .data = &drvdata[IMX6Q], }, { .compatible = "fsl,imx6sx-pcie", .data = &drvdata[IMX6SX], }, { .compatible = "fsl,imx6qp-pcie", .data = &drvdata[IMX6QP], }, @@ -1619,19 +1619,19 @@ static const struct of_device_id imx6_pcie_of_match[] = { {}, }; -static struct platform_driver imx6_pcie_driver = { +static struct platform_driver imx_pcie_driver = { .driver = { .name = "imx6q-pcie", - .of_match_table = imx6_pcie_of_match, + .of_match_table = imx_pcie_of_match, .suppress_bind_attrs = true, - .pm = &imx6_pcie_pm_ops, + .pm = &imx_pcie_pm_ops, .probe_type = PROBE_PREFER_ASYNCHRONOUS, }, - .probe = imx6_pcie_probe, - .shutdown = imx6_pcie_shutdown, + .probe = imx_pcie_probe, + .shutdown = imx_pcie_shutdown, }; -static void imx6_pcie_quirk(struct pci_dev *dev) +static void imx_pcie_quirk(struct pci_dev *dev) { struct pci_bus *bus = dev->bus; struct dw_pcie_rp *pp = bus->sysdata; @@ -1641,33 +1641,33 @@ static void imx6_pcie_quirk(struct pci_dev *dev) return; /* Make sure we only quirk devices associated with this driver */ - if (bus->dev.parent->parent->driver != &imx6_pcie_driver.driver) + if (bus->dev.parent->parent->driver != &imx_pcie_driver.driver) return; if (pci_is_root_bus(bus)) { struct dw_pcie *pci = to_dw_pcie_from_pp(pp); - struct imx6_pcie *imx6_pcie = to_imx6_pcie(pci); + struct imx_pcie *imx_pcie = to_imx_pcie(pci); /* * Limit config length to avoid the kernel reading beyond * the register set and causing an abort on i.MX 6Quad */ - if (imx6_pcie->drvdata->dbi_length) { - dev->cfg_size = imx6_pcie->drvdata->dbi_length; + if (imx_pcie->drvdata->dbi_length) { + dev->cfg_size = imx_pcie->drvdata->dbi_length; dev_info(&dev->dev, "Limiting cfg_size to %d\n", dev->cfg_size); } } } DECLARE_PCI_FIXUP_CLASS_HEADER(PCI_VENDOR_ID_SYNOPSYS, 0xabcd, - PCI_CLASS_BRIDGE_PCI, 8, imx6_pcie_quirk); + PCI_CLASS_BRIDGE_PCI, 8, imx_pcie_quirk); -static int __init imx6_pcie_init(void) +static int __init imx_pcie_init(void) { #ifdef CONFIG_ARM struct device_node *np; - np = of_find_matching_node(NULL, imx6_pcie_of_match); + np = of_find_matching_node(NULL, imx_pcie_of_match); if (!np) return -ENODEV; of_node_put(np); @@ -1683,6 +1683,6 @@ static int __init imx6_pcie_init(void) "external abort on non-linefetch"); #endif - return platform_driver_register(&imx6_pcie_driver); + return platform_driver_register(&imx_pcie_driver); } -device_initcall(imx6_pcie_init); +device_initcall(imx_pcie_init); From patchwork Tue Feb 27 21:47:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 207452 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2983414dyb; Tue, 27 Feb 2024 13:48:44 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUgIZHBsw/rYHJQBTVi2JsCRcTz6vg21WRS3/ojZbzPDa848aMH5QygpT08JAt9vAhR9Z8E8dwiKWkRFaa2qoUBgKZ6dw== X-Google-Smtp-Source: AGHT+IH/RZ4ms0d6QMBTDJkMxjPcn7BAEy5UP6AFYtDjiPvykEXqeuVfFggjDP/s7ka05D1f5vXu X-Received: by 2002:a2e:990d:0:b0:2d2:ab6a:e694 with SMTP id v13-20020a2e990d000000b002d2ab6ae694mr1044858lji.7.1709070523825; Tue, 27 Feb 2024 13:48:43 -0800 (PST) Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id z33-20020a509e24000000b00565cf08c22asi1032943ede.24.2024.02.27.13.48.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 13:48:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-84065-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=FTaZuuG6; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-84065-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84065-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 429FF1F268B7 for ; Tue, 27 Feb 2024 21:48:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E29FA153BD5; Tue, 27 Feb 2024 21:47:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="FTaZuuG6" Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2048.outbound.protection.outlook.com [40.107.21.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 525E015098B; Tue, 27 Feb 2024 21:47:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.48 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709070469; cv=fail; b=LoGPYCnN5w9Q82Edu6OUzeYOWWh0QkRitNHvcu7WhxuKngk+mRSOM0h9qmtZ20tLIJF7lXK08/gZ0d27LuO7XWjEf3RGeZh1xEp2kgOifccb+GAW7Fpj1BB9EgEy5CNiTEqJZkqeqqgK3y86Q8+EfXqqPBD2OJLuZzQE1QHFvFc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709070469; c=relaxed/simple; bh=jax7w3YeSKyiyCNa2W/Ldiw1ax01/mOleY5P8AfYqYU=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=GaFYXeRNZnveUVWGvtU4VvKki75quUcYyZEUYN7co9gICyDkFZHGpjN/zCQMo4sgvQvvdFTaLGKMZX+ENa72YOGSMny3Zwt7qfFEjhz2Wib+vVkC6isYQbHAslUXxNLiGGbuUXK1dZZ6eC/YR3xtORxPIEHfMNzIEJB6hE+F7yA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=FTaZuuG6; arc=fail smtp.client-ip=40.107.21.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EVfeVMOwsPlalH0Y4uuzyuLztoH674GDafu7e1w+g3F806gZj6ZnZXkPIIrDptSViBtsNqCr+b0Jz+H2HHfkeRQ8mlynGG7pBijSOneTXoSZXDCs0EmrSQTGfCBGmUIBeSSNQOmKA7C650TYzchrRFgO7aRcOWSc4ZmgA9B8GXi2FA45rPlMG8m6P6HK3KVW/BZVQaHWdeuYzPnYDZ2GKNx0uKSijON7DKTTvBNFRw70M53/cDJOTd3Od0ALbBeY7oMf0fJgi/LXJhTBN6l8ThGj13xiH0fPKmZN7B7WA9Tz79oY9L8VpIsLUWGaFjutd3B2cOwCnG0EkJ2OfBrAMQ== 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=WDHFWrjCyoKXsLP6sV2GTSZH9KE24ao5w8wAVmSeCgo=; b=bsK7oMcGPEgk30Q8+DPYpxOX0pxSFjxuFjnd8g1HgvFlf5RSQttpfUFMaF09xCQjFkzBEm6m9ptPkD0tjkdtlZGQoQt033+tEvERgxKTxMCzzvvqJfBgaAb7crKTolvL2SoY5IMqcW7nIst7awCTL+/Np1FgwfqlgVhvi/0Q5n7xoiZGJVAxZ4SsWeMcGgZwJ6k7BFOXqTbOXPu6i6qCdpYtXZwSc2eQSrashoIPsSLWv1WeNEI1pi2L9qr1FqqCiKAxhSOlGHKarcTs2kZdKPZkz9c6ib4PLxpeF4hGw5RXDf/ciOaXUkiI/kNxAc2GGCWorS3Q9Fo+krDmZUV/Fg== 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=WDHFWrjCyoKXsLP6sV2GTSZH9KE24ao5w8wAVmSeCgo=; b=FTaZuuG6lmeyj/5huhCYGQCPwQjo5ovyS697D9Z4T7sTRAa+tDuHZFrziSl3elg/Lh8AClQNxAkSbw9I2GIMjfXNPtbku7YRRiFWBmaf+xUuYRg49O1BM2aGP8z5qm1p1f6hZ2GExAUuIRsw3p1CWYvryBHvC9fxCXfFAZAJz6w= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by VI1PR04MB7056.eurprd04.prod.outlook.com (2603:10a6:800:12c::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.36; Tue, 27 Feb 2024 21:47:43 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9af4:87e:d74:94aa]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9af4:87e:d74:94aa%7]) with mapi id 15.20.7316.035; Tue, 27 Feb 2024 21:47:42 +0000 From: Frank Li Date: Tue, 27 Feb 2024 16:47:09 -0500 Subject: [PATCH 2/6] PCI: imx6: Rename pci-imx6.c and PCI_IMX6 config Message-Id: <20240227-pci2_upstream-v1-2-b952f8333606@nxp.com> References: <20240227-pci2_upstream-v1-0-b952f8333606@nxp.com> In-Reply-To: <20240227-pci2_upstream-v1-0-b952f8333606@nxp.com> To: Richard Zhu , Lucas Stach , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Rob Herring , Bjorn Helgaas , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Philipp Zabel , Liam Girdwood , Mark Brown Cc: linux-pci@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, Frank Li X-Mailer: b4 0.13-dev-c87ef X-Developer-Signature: v=1; a=ed25519-sha256; t=1709070448; l=2678; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=jax7w3YeSKyiyCNa2W/Ldiw1ax01/mOleY5P8AfYqYU=; b=CHy2ODfXM0CDTDa81x8SaQEkbhra+ZQ6KXeSguPvo8k2lQH1HxPL6HoPrWTvOIJx6vaQ8TKw8 09DTverntT6BJA6WqowkR8y+3wSRrXoQ8o6XTShVG1B7V9Q1vEeHcvk X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR11CA0050.namprd11.prod.outlook.com (2603:10b6:a03:80::27) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|VI1PR04MB7056:EE_ X-MS-Office365-Filtering-Correlation-Id: c536a716-2f4b-47ab-f048-08dc37ddb9c9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Q1hxDHUqp23am1gocVijphtui+huWJWMfcRXaUUKfKHTi8bz2TtphSthEigTsNSHeZS5f71YDia5koq7F6R8VyXkzdXrLQ4XMJNSfRokThAKL32LuLdWAcCCau64dNwmI0ir697rkBJJLc1cs3okYQVRbn9cFvomRp1dN7JEybjfWA1SSevZFLJDkqpuxKAjI9b/JbRH0NgEPgQVRNSNu7S3/dTNf4aOaDa7qEnFAImPsCe9XtWB4S2FeI9ZfBpOUFcyPaSeBbDZ+apmcD0TMWv6+oW11Ber9iITQnSGB+Hz7DVpLH8MXRfzYm9Oc85WF73UN+nGmi9vCp5srPOL+HGTug0SEgryO0uPRUIgdx5C6HZfM/E4FPIrQ/XXwIS50QMui+sMj7rEp8EtqUTQV2aZttLRvsDobT5mqnWiS3bMuZ5ThI2/U/txnXUkABAmp39Hl+56442IEb0+6kVDbyqrJdQ8MfIjRuijBnP0ZZhtPgYjow8OmbHb8CAAW+P+bb7ljQUi7XO5ytGSCz61uKsuh9MPDcIYHUrBmR9Ob12GfuJGYOUYiXtU+L9YT/r23rzWUIkU3EdNbIwQGKNAYIOQKhZo/70C/KqJ4iDGXNk+jjCSxCzxUUosoMiJST50luXFKGODsvuniShZIrpbvjQi2+vrasEotR9tK4qBOvxowuWt8T/nlznVymd5nN8JlEqMTvSHT+cHV2TBGdTKlZpb6Y5ZBIUkv4sRgD4lG6Q= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(921011)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?Zgi547dEXsNwcKR1KTk7Zz46Rgvu?= =?utf-8?q?LNixfu0wXqjbbXKpRMGt+wp7gJfjEH6eoHGFA7mgVwZslHztvtj2g4ygqSGsjobKS?= =?utf-8?q?yrUfEhfL02WCLNSDB2SPwji20Qu6TyufQ4UfbG9MLQihuKLB9FM8GV65VN2+XBUO8?= =?utf-8?q?bmwIyngONxWebteHcKkMkOeyJslHaFrhuMmiuVjTABROrRvcT+Q9dBQ+NBeW0+vm0?= =?utf-8?q?RLfVeW8JKCvfkR4ju/pi5ZAPoHbuXkVFPhM3whgiLEVWk25vCkF1F98G5vr/5NNAF?= =?utf-8?q?rXBbUkW05Y48/0B2O7Fk/0ZmHDWXhJwQK+9wJogVdFK8Bn3RNQaIlP+hJPimHCBu8?= =?utf-8?q?iNGlaPNJj/tEU0M2A2NhZFlXAFgFalryi6bi+757IjFOBlzpjDR9H+zN9bp7afiqD?= =?utf-8?q?2+TkE+Yo9z3s/esh1D6UpyrZZCJvvwSoYbCK1dh2vV7rFbk6aYrFNy35OQHIEaxqL?= =?utf-8?q?cgvsNr7yj4koGyYe7PSj0ncXp/MLKyM67vpWOtMqV9BXA16rPRws1MOWjKyDD5oll?= =?utf-8?q?f8v7wuNAbk6RuISOVVviiAIl2EXIVX0oTgL4X9eRDnkOzE+TVdlEFHpL08GI+3hkn?= =?utf-8?q?OK22eE9V3aI1TW5zLImZG9yAhtdV7Jk2F3VcmBI9wAa4uEY49G9a10PT++8SpQJq3?= =?utf-8?q?c8tkf9ULCbc72Gvq/+5kRkJC3eMrxuYYTMyUjDmFa8oefAwvK3hzryypv1stkQ1bd?= =?utf-8?q?h2DUj+B0noxl/1izpGYZjaQh7jIKsZYckD7N0qsjT+u+tBtkFxaAkK4ufmQP6gaEY?= =?utf-8?q?G2bte+k/QuSwz72irYeBTtyNE6E7UfG3triykBoZQoJaT5Telg+ckmUKxZwrXFz4m?= =?utf-8?q?sKLzouLyeW3Ii9K2g2ix3UztrPcyFcmjpZmI66cNQ3eT2TzcPYtAOMrcRCinnRxpS?= =?utf-8?q?rdxFELVXGCgqD2EaeJDArkWCPYnFwu4/dpl/PX9klHMCDCod68iCCG/4sjNxxCyal?= =?utf-8?q?XPfWJEaaJEfAIpX4jW59tfjHSCSoZy0mWm43KZn/fPS9fqVlyH+1XEi7YnHDs2T3o?= =?utf-8?q?hy1X1JCwjcvICcs9Z8gDAWBrRWTunyQTh9Wa/6UNdRAKIZC5xEdU91KyBjgKJdV70?= =?utf-8?q?sGR/b4ah+cqLgNw/kCbqbMing8d2C9hEJBbN61x/QyNntqJhsZizROhvh3IzAyZZH?= =?utf-8?q?xD0x46NQIynaosn+Vt+l227Uv4wHKw98MGxKWNpi91daTII2B8XrcvzbNzK3JO5Nx?= =?utf-8?q?eaa8FkSuJcGUFWHCLPJjNntJNhzUckbE99Rfpc+vyiVgd5wGyMC6j8G6Z5y6axRgC?= =?utf-8?q?FBdWuDHB9uJq8XsHC6snaAOPXwnCA55R6xUwy0UbzJw9AGL6C8vYyvQ8A2Qr0K4BT?= =?utf-8?q?lbk7cszCZPWtyHRTTV4zXpAOsh6prt/Vp5acLNPrOf4dJzmfLU2fptVQ1PwS5hN1d?= =?utf-8?q?KPZTIVjJlbYNnGRSFjnLYB8ye7pshI5h4M9fYCwT1nDMhR28VTy4Bq/lwFsFZ75IW?= =?utf-8?q?pz/V66K5YqZdlX1efOJuCNnhVnfz0L45TcJ7Bz6o9+5vLGC0vRsOOp26tden2+gvM?= =?utf-8?q?OotMgyNVR/yO?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c536a716-2f4b-47ab-f048-08dc37ddb9c9 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Feb 2024 21:47:42.5202 (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: acf8WSXHnt8hf6ALopobdEkdtfCutiGNzgmNV0tvAoDCvN+tW8CtbMfbRkm21/2bAkQBsV5wmfpxWFeBDRVEkg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB7056 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792090333398123021 X-GMAIL-MSGID: 1792090333398123021 pci-imx6.c and PCI_IMX6 actuall for all i.MX chips (i.MX6x, i.MX7x, i.MX8x, i.MX9x). Remove '6' to avoid confuse. Signed-off-by: Frank Li --- drivers/pci/controller/dwc/Kconfig | 14 +++++++------- drivers/pci/controller/dwc/Makefile | 2 +- drivers/pci/controller/dwc/{pci-imx6.c => pci-imx.c} | 0 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/pci/controller/dwc/Kconfig b/drivers/pci/controller/dwc/Kconfig index 8afacc90c63b8..647ce302e5ebb 100644 --- a/drivers/pci/controller/dwc/Kconfig +++ b/drivers/pci/controller/dwc/Kconfig @@ -70,27 +70,27 @@ config PCIE_BT1 Enables support for the PCIe controller in the Baikal-T1 SoC to work in host mode. It's based on the Synopsys DWC PCIe v4.60a IP-core. -config PCI_IMX6 +config PCI_IMX bool -config PCI_IMX6_HOST - bool "Freescale i.MX6/7/8 PCIe controller (host mode)" +config PCI_IMX_HOST + bool "Freescale i.MX PCIe controller (host mode)" depends on ARCH_MXC || COMPILE_TEST depends on PCI_MSI select PCIE_DW_HOST - select PCI_IMX6 + select PCI_IMX help Enables support for the PCIe controller in the i.MX SoCs to work in Root Complex mode. The PCI controller on i.MX is based on DesignWare hardware and therefore the driver re-uses the DesignWare core functions to implement the driver. -config PCI_IMX6_EP - bool "Freescale i.MX6/7/8 PCIe controller (endpoint mode)" +config PCI_IMX_EP + bool "Freescale i.MX PCIe controller (endpoint mode)" depends on ARCH_MXC || COMPILE_TEST depends on PCI_ENDPOINT select PCIE_DW_EP - select PCI_IMX6 + select PCI_IMX help Enables support for the PCIe controller in the i.MX SoCs to work in endpoint mode. The PCI controller on i.MX is based diff --git a/drivers/pci/controller/dwc/Makefile b/drivers/pci/controller/dwc/Makefile index bac103faa5237..7084e615b2774 100644 --- a/drivers/pci/controller/dwc/Makefile +++ b/drivers/pci/controller/dwc/Makefile @@ -7,7 +7,7 @@ obj-$(CONFIG_PCIE_BT1) += pcie-bt1.o obj-$(CONFIG_PCI_DRA7XX) += pci-dra7xx.o obj-$(CONFIG_PCI_EXYNOS) += pci-exynos.o obj-$(CONFIG_PCIE_FU740) += pcie-fu740.o -obj-$(CONFIG_PCI_IMX6) += pci-imx6.o +obj-$(CONFIG_PCI_IMX) += pci-imx.o obj-$(CONFIG_PCIE_SPEAR13XX) += pcie-spear13xx.o obj-$(CONFIG_PCI_KEYSTONE) += pci-keystone.o obj-$(CONFIG_PCI_LAYERSCAPE) += pci-layerscape.o diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx.c similarity index 100% rename from drivers/pci/controller/dwc/pci-imx6.c rename to drivers/pci/controller/dwc/pci-imx.c From patchwork Tue Feb 27 21:47:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 207453 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2983482dyb; Tue, 27 Feb 2024 13:48:53 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU3kWsvFazsYBqEObJbgKSuAp3rTGm28GVG+LntfTOqTF0c0tM9EayieDzhWQ/DBlfzEkij9LyAmjpc7AmQMQaa0P6PYw== X-Google-Smtp-Source: AGHT+IHRewwkVHB6XAu8KWblrlOp3NDn2YO2V6gBEqnI/pDHgbMKpbR0JeuVU5QTszEYMn490yFQ X-Received: by 2002:a17:906:c307:b0:a43:1099:7e69 with SMTP id s7-20020a170906c30700b00a4310997e69mr5963855ejz.11.1709070533638; Tue, 27 Feb 2024 13:48:53 -0800 (PST) Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id j3-20020a1709062a0300b00a3ea1132f8asi1025898eje.661.2024.02.27.13.48.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 13:48:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-84066-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=CmYW+cV8; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-84066-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84066-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 1943E1F248D1 for ; Tue, 27 Feb 2024 21:48:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ADEE114F988; Tue, 27 Feb 2024 21:47:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="CmYW+cV8" Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2048.outbound.protection.outlook.com [40.107.21.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4DB8C151CC6; Tue, 27 Feb 2024 21:47:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.48 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709070471; cv=fail; b=dM6ukQXFiD66QVjWWCEOzdsBMyKBBt9KS5485Ar/fXd96p/fnuAVpaYR76nWCgWHcliuZ+FleJ30kt/amnUGaZB8wTqYa7vcI46N1yoBUweSOyKr8OJLanza/WMLtHB1PV9F/pRAbrDWr+H1R5hM/6mBziD4cv1vvvcm+1poD4E= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709070471; c=relaxed/simple; bh=7LEmma9asVcc2UpABKTIPCze0Rfq/WnOrCDirUI9M1s=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=a+PRoYPo64l4XIHaspdFViTNJpakObY4tR9L9Aigw3NF7iwyxWVGX/TcB24OYCGzN2RNGPhwMsfGr7lJugzmPEQGaNBY1iGwGFFZjtr4gBtkBFSUZ8wUqBGTghT/XfjkoEdx9pX4OL/UZ1h/SCfK6gl1qyvWkIXmkzgCqqx8Wog= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=CmYW+cV8; arc=fail smtp.client-ip=40.107.21.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jqcCW5RtrrA3AQXassvQ6NQra6Wkf1xylgcf3nnl6sjuqwJiANKt7j1XzfDCCmG7l9Yz4dsY4OPaeBsuTqhriw2yhyKUAglrqh9X/sjVSEfYr53jmU/UCmAElhNPzWAMa0R/yCWZxqiPTw2zsTDZuxsJCIdUGLZtQA6hf0rayIod0ClbF2+I7T+91cJQH7K3zg39mH7DVvdt7RyVyVO5OrjOGLEuwpP8hSMwJD50A3O/S+fIcNkCreI7W+3jMn2+GOOTREnkE2FJs0CGl2NU1vwjLU5M6ddi1HZqjuXuwZwtsLoIt8OVKjuuDL1HqkROKwb4yyeNomlVW2z+Ofd7QQ== 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=bYoXCN2Cg7BevWD2QEgj8BjNP6h0jRB2sBiityVf9KU=; b=e+NbHbUsLzu+lEDC/gx8gmn0HydEiZuLoLoUtTx5U1CKO7AowVZd9ZIv6VgzA4JGXMsbLZYgxfoBNdG6iaHFW+Ipqdt3ajl3c5Yy0QKwYe85RDiMTmC31sEczwFAaeI4D5N1H961Kz7/qclNxZDfrTrnTZKFm8yr723rXg4Emig44irvjloTp8ZqVmjSj7ZNFZGL/KH6HcFUAwFEs5HbgYm7nMmFVQOXKceMomjjZJrPlObmz6lnJnT871arbyVgt2jt5m2acpnX6ZuFQ9dq2a08jmFgDyzOoSoWdl0x0IkZ+lpektYluhhfTYnI1NEgNXugpFuCQz039mgo6hLjBQ== 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=bYoXCN2Cg7BevWD2QEgj8BjNP6h0jRB2sBiityVf9KU=; b=CmYW+cV8diCZj1cNn/QPkPMOf1c9WlrOiKZY+KZpbBAno6wX2139T7KSfIp3+byGUvEisWBOBNjYzngIn5LjYdb4o0A9eFrLskh4yuezS6dB5jQL1S6lEPycMLWkmDLXXO8bpYuzngytMVSlDF2cjypkIPuDhsCt5o9IGfHbQMw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by VI1PR04MB7056.eurprd04.prod.outlook.com (2603:10a6:800:12c::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.36; Tue, 27 Feb 2024 21:47:47 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9af4:87e:d74:94aa]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9af4:87e:d74:94aa%7]) with mapi id 15.20.7316.035; Tue, 27 Feb 2024 21:47:47 +0000 From: Frank Li Date: Tue, 27 Feb 2024 16:47:10 -0500 Subject: [PATCH 3/6] MAINTAINERS: pci: imx: update imx6* to imx* since rename driver file Message-Id: <20240227-pci2_upstream-v1-3-b952f8333606@nxp.com> References: <20240227-pci2_upstream-v1-0-b952f8333606@nxp.com> In-Reply-To: <20240227-pci2_upstream-v1-0-b952f8333606@nxp.com> To: Richard Zhu , Lucas Stach , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Rob Herring , Bjorn Helgaas , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Philipp Zabel , Liam Girdwood , Mark Brown Cc: linux-pci@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, Frank Li X-Mailer: b4 0.13-dev-c87ef X-Developer-Signature: v=1; a=ed25519-sha256; t=1709070448; l=1049; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=7LEmma9asVcc2UpABKTIPCze0Rfq/WnOrCDirUI9M1s=; b=Rk++xqe9r92Mg398eUNTWOa2qxJF8YQE9bYILMC3hDK+0LF/wIVf48BF+tpwDYltFK16pOsRd kuT6kR+uRHPC1NNw9AL1ESb8H6/RAmph45zFA0HRmiuaK4SPvoNF+05 X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR11CA0050.namprd11.prod.outlook.com (2603:10b6:a03:80::27) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|VI1PR04MB7056:EE_ X-MS-Office365-Filtering-Correlation-Id: 3f0516f2-d877-4714-a7b4-08dc37ddbc8c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EMIa3RaDAEdsRk5Zjlw1e7Hk3v/0EGiXRQYdXtH9YSfY05CY2fldIYM66iejjs8Cya8qME+/BlC1ZweUHQsR1JlaZk9QMP7+5IlRmm8VAgeLHCf8CF6B6Hu0kX6v68R41Gso0S2d9CbnFerN0SHjrwmocLeEZKYyWayBy2qUY38fF4Knoa2YmdZJh0Nm1bjc1h9Awocpd6J34ArV+eE4fXWSkemHeMtlRDeyBT13f7CblXGYSaZ8peUoXwvWaIJsWTpN4rfwN7I+KcTs8vC9hLcEX1Gqg86w+OpZOosxlDtxIm5BcMjyxxP3iRqxqIJZfrh5wO09MCHB6Mc7ko9EPTeNQIo41krG3W3MDavSUpdyLtp2i+e2DgEO+yxNqgFRIjHiNApbvyo+GosI2yi6TQsOIzeO7SJs31JOf17+H2543qewc+qjZDR5635BEDC5z9BD//k9oZTxq74fXe3YCcw/Uc4gdDbRkWl7iyMvmSu1oCRyvm+NvQs8Bk125lZ7q/YoRU3iVGDCOXL2H/upAGAVpaWLBV83s734ApgtGuyOIxMffNsEu7qQgb3W41fc56FW42uAk7sraHcdM6HiNvhw8Z7ayMZkIkAU6EDccubEdDnDODqxrcxXgTjTB5eiiC/74ucxfO9sF5/+yPtOpMRdG+4Q/T8nbmZw7mFVwYv7kE2tpEC9oD8OlpvIo19mdFtYJSPDi0LCm6IuG1YLWWmDDVMyxakboRa0CAI8GGc= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(921011)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?Y86dPaRmamNaWg88zoNpct0nwcFk?= =?utf-8?q?Snz98DnAWZZMZeyHphGBW3LSobsIKYw7uGr14CkuygGbEadmv9RA6vXya5j8REBuS?= =?utf-8?q?Fb5dk75rdUkKmRcp/S/wLng//sVO/Oy9+zw6HgRONr2PHHKUrq4Cp4njXE24jswiO?= =?utf-8?q?/u8zZIgw+4VEBx8nsUu1+/ZeCL4XKRiQHkBYn987WRznJMGCT5iDFp7e5VlgQajiE?= =?utf-8?q?SB9UfMUpBtX4ku0XjmHcNgMqOXjIxX8vEdT6uV1WLDVYqHm2GNTmuCN2ldtOoEgCJ?= =?utf-8?q?UsE2OH3wh0L4yMqetcplppvFaMt/RprsyYrJeXobBvELxV7RigSEodvwsQIwPB26b?= =?utf-8?q?9Ght8rbrcESS2uaHx7n22mlN+CFeD0pW73qe7H4kA+69QgUTBXa65+qkcZw0G45tU?= =?utf-8?q?AiR1w25ue2QmQrVs89RoBGqQWRzPxynVez9FcGZrTFDTCsk0BnWJFL0OLBmqckblL?= =?utf-8?q?Q14R+9tFIZ7LdPvC4RnY9KtveFeI+ebtHzjpnowZh1yuk7GI05goa3fUte4MKH8vV?= =?utf-8?q?VYBefOS26DPMUim14yyf1R+T2PBltlyyDtrR9UaT88YVFMZt2s9hliBt4QWRWe0au?= =?utf-8?q?KGPvbdYahstdbG5awCtxBI2Vy5JpwIOgHpsX3/hUGR3JTjpAWbDOJxsHE0C9Zte6E?= =?utf-8?q?TgoYuGUwLJU6xBReqD6BJQOd/X8Ys5fh2eu35afQn/6Euk6OYKkO2nQKU5JIWYGJn?= =?utf-8?q?SbVg5gI7qvkOdhjSAJG//ZG5CtCBYYOzuOA186ttks5X1ETPlwwKBHBFQWIcXySGC?= =?utf-8?q?ITWj116+GZo7rkhMt0klavJQ8aDCpHnPWz1/JtKiNeOHlZUvM2N4fcjICYvrSkeyY?= =?utf-8?q?Mz5xf/6eY4bYn37Z/a6qtBvMgKJ7UsEluK3bYAT6YYADrXStko7oXRllJc+0N8HmV?= =?utf-8?q?nBQghYW/aVckBvetUE5MYBgY33lDrTZjYk0/GedM/10L62CJqSs7ntOXc/2tv68yZ?= =?utf-8?q?JeUKiKSdtQkn//0NAMefE4YVRT+qZwyBO/YBkbhhggCy6uB6jTD5H2l28WEWLknPM?= =?utf-8?q?wooHtZW3G0XP6q4LJrBgIVVq2H3jUXABcIt566CdMb/ulF9q7jr64I1XRrvQ7eSk7?= =?utf-8?q?xIugw3I44Qz3HgFdxvPzYvYU+Lf8u+aEkfXnzU0O7LrYVEbWMMYMJUZbmLsX3HVFY?= =?utf-8?q?49liza2DSm4kFCDTEpBsNOTA1c7UxaeYy1SsfzVK4x3LD3uZF20Vce0A3ZQlmZNRZ?= =?utf-8?q?V0/bX18BeWZcaxcfXm2joatkg4/cvZH14uqvPBXa0Qd/uMVZvzpWYU8PMCKk8DgxK?= =?utf-8?q?AB0i1SBT7ghuzIjs2fnC/rwUlG/9Zi1DCIzomxdzVVcoI79KLBXaLJzJPett8dXex?= =?utf-8?q?1P+3Y+f9s9R8cQ3bupMf5ncY/eWFew57PPOp0KhWltUicjUtsqGpJdpLdVKpbfZeN?= =?utf-8?q?KINFsB57bXrMiYraYctkc2jBaJGyBuoGVRFAT9j3EP4zV1hFkIOMyl0ppQyriC1GP?= =?utf-8?q?rIsuYiizHbdoNZfU8H5U0Yk3YpREPWctdfSzMFOL6msNPDS+kgBBpzuj73dPBOXZW?= =?utf-8?q?HHt1yvrumXJJ?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3f0516f2-d877-4714-a7b4-08dc37ddbc8c X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Feb 2024 21:47:47.1226 (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: naxqwn5NOeOCQuqHhZWfYZI6Q8saADflOT5zI+vtsgfJLdFPY5vrF8QFo+KwqbId9T2gqK2FtZWI5GthqMXfbw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB7056 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792090343502384339 X-GMAIL-MSGID: 1792090343502384339 Add me to imx pcie driver maintainer. Add mail list imx@lists.linux.dev. Signed-off-by: Frank Li --- MAINTAINERS | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 8d1052fa6a692..59a409dd604d8 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -16736,14 +16736,16 @@ F: drivers/pci/controller/pci-host-generic.c PCI DRIVER FOR IMX6 M: Richard Zhu +M: Frank Li M: Lucas Stach L: linux-pci@vger.kernel.org +L: imx@lists.linux.dev L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) S: Maintained F: Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-common.yaml F: Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-ep.yaml F: Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml -F: drivers/pci/controller/dwc/*imx6* +F: drivers/pci/controller/dwc/*imx* PCI DRIVER FOR INTEL IXP4XX M: Linus Walleij From patchwork Tue Feb 27 21:47:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 207455 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2983654dyb; Tue, 27 Feb 2024 13:49:21 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXMTUUpAsK130Pl/fqUvT0j4tUlbeu7MW74fx4K6iGTidVaKh2jZlu317I5sy64Ewo4elTQLbOE9wWoz2Uaaa+fQ1+qZA== X-Google-Smtp-Source: AGHT+IHolC6WBcos1rj1aehwWWnEYg5vxqpLaxNRRyZ1x5qBQkChTPhLtAMcxPd3pX9tUnlfVz7f X-Received: by 2002:a17:90a:e2c7:b0:299:35ea:cfb5 with SMTP id fr7-20020a17090ae2c700b0029935eacfb5mr8779562pjb.2.1709070561031; Tue, 27 Feb 2024 13:49:21 -0800 (PST) Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id l11-20020a17090a49cb00b0029724b7788fsi40473pjm.9.2024.02.27.13.49.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 13:49:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-84067-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=S92c4uMF; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-84067-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84067-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id BDE0D28840B for ; Tue, 27 Feb 2024 21:49:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DF9B0157E74; Tue, 27 Feb 2024 21:48:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="S92c4uMF" Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2057.outbound.protection.outlook.com [40.107.21.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D65CF1552F7; Tue, 27 Feb 2024 21:47:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709070477; cv=fail; b=sesdjGLuAfNbFEPsbLR/xKc8tqoAUsBakkR6uUd0/FWgD/Hf5Gv+xBHCc3X5bMCXzQC3vpfivzABoxRLfqBvhHm0gEXdoUyeaiK/pcGwg9zPeted6Y/+VXNcVHCsow2u0mrvZSD8LINarMxu1TB5nIvLEBHlBkyyc6r6yNZm01g= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709070477; c=relaxed/simple; bh=cn/ufN623D22XcRlM3N35TFCdHgjo7eM67GEijjta8s=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=s8b2i7jEr4kBHmwBldeaUOrzK/SENr/y0olD2Zj5DfIFKu3F1fnC6SSf1bdeZCXlmqMxHIppy8mXTDaBYQFjAsqKRt5MZPf5BWLK4U5ccXR0UmLJllREM8Hr6nGfn7/4ctRCAH+retu5q6g/WHxU8qkqF3gixYitm1W5Ox31PuQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=S92c4uMF; arc=fail smtp.client-ip=40.107.21.57 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i9NKSOSc6iusRKS/Abs24Iem1nJ8XCgtCIbFkcSoqGazhQp2LKVu0qET9qdvb9VHDuDwx18WsIX+97VCxUYhg0LP6MsduqlEmJq/A8S7srIZGMk88hYcpodMXmqA9MGOb+JfbfI/nfXfGLKQNH3FVKs9lLg1iFjdZBDal2A9m6jh/q1nwSNqIGg2bsHLF6KK6srgY5sGSAbTFfwo1H1+M4N0nJIqZjuIaB8e7Ss6Ck/+haI+AVH/duiSsgqJQMLJiQMICKkopmB5Hbkmv+wcQRAukBiur0XL1Sy8Q7jawcgXhRH9VoUuE+zzxD94AWFv8VOQ017SI9a6+mjiRgzjLQ== 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=O9NwUPHoYMcETkXgNCojiyj5+UdKPIeBtSfBhZUFfuo=; b=Qk8lAj/UjvMu+y8YmVuuYRKaHF2Nj47uX04O2qCEbpvbU/EQh9NpV/OIYj1QLujPiFpq4W8A5x7vjvLy0lqL6D6p55JOxLd/2yVDxuyr4eMLetQVBbURBXQeURNBYc/9bjTHNRX5N2FuiMAy6fE9PAMn5nvMWWIQO2fRXyVdROBLMxhW2tPbiIW6HQqNr00oQXNO9SofH5oe5uP0S9wuHzHHEsa41GiEEKAJE0OP82IsC6WjNZ7c+QOyim7IUXrYDV3ICcFs/FqsXwlBwK4kld+wfmLuZNfaRGat8PkG1cAA+pKQs621xNkVOPNMZ4f0cPoUmcPQ9D4+yNKFYuN1NQ== 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=O9NwUPHoYMcETkXgNCojiyj5+UdKPIeBtSfBhZUFfuo=; b=S92c4uMFynNSR2cf6L7ZDbtWKtLXVlH4GSDMu6L5Q0jrCVyoGEQU+MunKwLZLC5WtuRT85dYAjzlEwlGOCWuZ/FAn+AB3iznGE7D1MP914QxzmmxlwFjycF2qr7XKMLfplSZzXBcDCVjZLFLRMaTcusIUpEGkgG0IEct1KJ35VY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by VI1PR04MB7056.eurprd04.prod.outlook.com (2603:10a6:800:12c::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.36; Tue, 27 Feb 2024 21:47:51 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9af4:87e:d74:94aa]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9af4:87e:d74:94aa%7]) with mapi id 15.20.7316.035; Tue, 27 Feb 2024 21:47:51 +0000 From: Frank Li Date: Tue, 27 Feb 2024 16:47:11 -0500 Subject: [PATCH 4/6] PCI: imx: Simplify switch-case logic by involve set_ref_clk callback Message-Id: <20240227-pci2_upstream-v1-4-b952f8333606@nxp.com> References: <20240227-pci2_upstream-v1-0-b952f8333606@nxp.com> In-Reply-To: <20240227-pci2_upstream-v1-0-b952f8333606@nxp.com> To: Richard Zhu , Lucas Stach , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Rob Herring , Bjorn Helgaas , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Philipp Zabel , Liam Girdwood , Mark Brown Cc: linux-pci@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, Frank Li X-Mailer: b4 0.13-dev-c87ef X-Developer-Signature: v=1; a=ed25519-sha256; t=1709070448; l=8514; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=cn/ufN623D22XcRlM3N35TFCdHgjo7eM67GEijjta8s=; b=UXlwlz3Xv717sRD52OM1TRqCgJjSfwkHQbd3CGFzlt2RMMQX9xBAZ4Hk8nOGcdhWKGcgcVLDR FYT7VAPiz0+B3nCLSgfIAow7vmQlGcCHPzSC7wSe0pR0x7cHeEC6oFn X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR11CA0050.namprd11.prod.outlook.com (2603:10b6:a03:80::27) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|VI1PR04MB7056:EE_ X-MS-Office365-Filtering-Correlation-Id: 6c6e0f52-be8a-4979-e4e7-08dc37ddbf4d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ju585KNPUwSscCkSy5A8M5PeSQ4HNhL+rBWcX5Y51Uhjzu7iZ9cz4yL1VcwAvS8hIkiPWkwkz6LxxoAdOjoWhwPLbgdHSwTh8IRUrcDl8IYDF5mnTcrAyo2DxPTHQhqrgeURyXIVGuwYnz8fpUe3GOxFd5qd7jPA37tTbILAYRF6QqlLBToobr9EXS4AJe1qbWgJbQy/IT1RcynjLucYT2CNIWN8Jc4tKF0dInKxmzsTN3SpgUEDVvstsGjBi669TX4GjV1cz3e0rV2X7gVnzIkZBfwPiFyTLCzJU6hTB+khuNVzfxR/w1aOxpcMSGy0s0s2uWS/C3IG9eB/s/GupTJq0n4VALbPqyKR3zjEAuv9L5j3NCYNjuTedy4B1fYENaYufIdBUfcqu7B/HDidhlRjNDt0bL9k4TOElUe9Mo7VWK3Fb37UyC/BY0DB/DDpgWjecGK9VCH1PgtI3BST1T68/BK0bx6LJQ2cND2qk/wHWmP4Ehxk8H5bEObBDxJwAkmFLIF7frKybOAa/0w2Ul7MGqKcAtSxI0qhuYoQ8B4P7VK6AuvJ/caglfKwoJ57pLgJkf1vqxlq4fK9ormMeqap55WU+EFAHBqHzdzK+YEDpePaPhkjYUqOaDJuwmeSQwRnWhwU01NWCVzZEP8X7Dlgkuz784aq6hJXuu7b3psrBDGWAPCIigo8fdlqM1ZHMllV3kZIS1nuHlbNjYn796x62vVAAgMDWySt4568VcI= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(921011)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?7ugf6/TXxOz1g+69D0x9Ft7HN2R6?= =?utf-8?q?Dr/ala8P46IzZ630vPA+bDkCQqTj8U6uD+Irazg0u4ozgze6s95BSng1iHUowQEp3?= =?utf-8?q?fnOBFuJoP6tHIxjTwxvvdp5f0fAahmKN2WrkcgQhQpaaEpAy7FZTInwTbQD8ENXu8?= =?utf-8?q?NZm4qwa6aVNHgb/HZQp0lpgQsVMnJUpm6UncFgN/BMOQr6LQIhtbGie1xn2isaCPc?= =?utf-8?q?aH/OjPCpZBhkRJR1YjSkD0YdH/K/AEuObeV/OG0iNBC/Z+e2KDddf+dWmnYndsWzk?= =?utf-8?q?nyLAGQwrlOZqBTET00Wxm08vXbBQtsACU2Jq3c3bCRB+423h38KW1XV14+zKQ51sm?= =?utf-8?q?XevVe60XBztQ7RdqYg+uJKrH6AFsuEKoDeEqETP+1bFkuWxeEPaiRmQuR4YT3i+Tz?= =?utf-8?q?SBJVgGqh6fMf8Ot8Nyjc+8WRETMlO6qIAFWeru2QkDGOOGjmwFc9z7/oMD/2WImXc?= =?utf-8?q?YTi3eaUflrphhicP0p/ZnSyLREwVmX82zsQSbEmKqcyhXYRtlhK2yWR2zoc8W9Fwo?= =?utf-8?q?7PfoUI4tE4Hzr4nMRQQcmhCGRHMrRQAypCKXJNWK37C8LAzPIwgRVEx4t3X1kw736?= =?utf-8?q?VLAt75TtGPu+gEr9OYF2jV9WHrMUwLxYMXgiYMpYXXT0pV4h/iCXP11viWW69L2Xp?= =?utf-8?q?+ecoACrHeQzq5pREIIca8OfJP8qZWTs/m+ZKiAULabmSqBqKMEsMOLrousJpwXs9d?= =?utf-8?q?tfGbceT6UfM92Do38x1+H7Oahv2I188TG5eNzAemIDSXehLVo4BMTfr0kJWQr84g5?= =?utf-8?q?eimuW+cJb6aC/KGaLR4Odf09lhntwNdJPuaiKymdrrHv6W8vzjplxmPPwCWBBL+H+?= =?utf-8?q?U45d75v4xn4zk6Psdur+8VTTqWRyL2eTGw1r62B8veMAnY7ky6ffSNpdegXbmHFtp?= =?utf-8?q?zA5Rze/LAY5odNJe1mkhn3+Zp2Z3SD13Ceu8ryBoE/VV0gyMuHQEh3sFy19yau6Hx?= =?utf-8?q?nzH/FgaicDyFjI2CS5yp5KaZsGmsRGo9wtGP7jIomm4fWk1d+B93FDxX1MKMg6Tnw?= =?utf-8?q?SM8kdBGxAEwnFJf+weOusfWwRb7cvMA4GC5WaWnJX8lwvgTcCDDICNKf2vFS2prHb?= =?utf-8?q?OO+bmHPYbjNXw2EtH/ky3dkUFNIwiy/9EOdrvXcZeB3Z3pCC71gL0bsoQp5flLaEH?= =?utf-8?q?fiIH1ogS1ixVJsC53ApRNlcZ3QhVltlZaobYmmxTLXErPW+nyKURgNTfYz5BEupD5?= =?utf-8?q?vpcveU39C2ohxZh9ifiQWGmbBR5+mxcKsS+KyJ5qeyExCFcEZ6C7GmxB4XpxE/sWd?= =?utf-8?q?w+iOjcdKUCMpVcsL9gSqEANoFuqzWeUpxIhmxFXbDhwam8yddkUww5Fw4NVYHE6a9?= =?utf-8?q?Fo6Q1TVvcPApR2kLtsJeCVNn4JI9L0vblLNCtmQ7nJp5Xpj2uvdfp5Crfc0W9QynP?= =?utf-8?q?Bz1nN11aVIMKVC6kyM8HIh1O21ejps3A0B/797TnZ1Qy3IQtQ7NSxZ8r+UPfL0GYF?= =?utf-8?q?n46w8IcO4M0nZTfx3o40Gp7JfFNr7xP8zPvVo66dPCfvfy8qpIDxaXoGXMxwECpPf?= =?utf-8?q?aC6YiXlqUvfW?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6c6e0f52-be8a-4979-e4e7-08dc37ddbf4d X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Feb 2024 21:47:51.8577 (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: yF5Z3jUtvkv/pyu5AlzpUOzfLP6AjMvO+lIv6sRZCxTPsK7I5pZyBHjYU6FClVa0TgI951kzxJ1U/td2tDhjvw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB7056 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792090372435930075 X-GMAIL-MSGID: 1792090372435930075 Instead of using the switch case statement to enable/disable the reference clock handled by this driver itself, let's introduce a new callback set_ref_clk() and define it for platforms that require it. This simplifies the code. Signed-off-by: Frank Li --- drivers/pci/controller/dwc/pci-imx.c | 119 ++++++++++++++++------------------- 1 file changed, 55 insertions(+), 64 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx.c b/drivers/pci/controller/dwc/pci-imx.c index e646ad70a2a5e..a63ce171ede8f 100644 --- a/drivers/pci/controller/dwc/pci-imx.c +++ b/drivers/pci/controller/dwc/pci-imx.c @@ -103,6 +103,7 @@ struct imx_pcie_drvdata { const u32 mode_mask[IMX_PCIE_MAX_INSTANCES]; const struct pci_epc_features *epc_features; int (*init_phy)(struct imx_pcie *pcie); + int (*set_ref_clk)(struct imx_pcie *pcie, bool enable); }; struct imx_pcie { @@ -585,77 +586,54 @@ static int imx_pcie_attach_pd(struct device *dev) return 0; } -static int imx_pcie_enable_ref_clk(struct imx_pcie *imx_pcie) +static int imx6sx_pcie_set_ref_clk(struct imx_pcie *imx_pcie, bool enable) { - unsigned int offset; - int ret = 0; + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX6SX_GPR12_PCIE_TEST_POWERDOWN, + enable ? 0 : IMX6SX_GPR12_PCIE_TEST_POWERDOWN); - switch (imx_pcie->drvdata->variant) { - case IMX6SX: - regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, - IMX6SX_GPR12_PCIE_TEST_POWERDOWN, 0); - break; - case IMX6QP: - case IMX6Q: + return 0; +} + +static int imx6q_pcie_set_ref_clk(struct imx_pcie *imx_pcie, bool enable) +{ + if (enable) { /* power up core phy and enable ref clock */ - regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, - IMX6Q_GPR1_PCIE_TEST_PD, 0 << 18); + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, IMX6Q_GPR1_PCIE_TEST_PD, 0); /* - * the async reset input need ref clock to sync internally, - * when the ref clock comes after reset, internal synced - * reset time is too short, cannot meet the requirement. - * add one ~10us delay here. + * the async reset input need ref clock to sync internally, when the ref clock comes + * after reset, internal synced reset time is too short, cannot meet the + * requirement.add one ~10us delay here. */ usleep_range(10, 100); regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, - IMX6Q_GPR1_PCIE_REF_CLK_EN, 1 << 16); - break; - case IMX7D: - case IMX95: - case IMX95_EP: - break; - case IMX8MM: - case IMX8MM_EP: - case IMX8MQ: - case IMX8MQ_EP: - case IMX8MP: - case IMX8MP_EP: - offset = imx_pcie_grp_offset(imx_pcie); - /* - * Set the over ride low and enabled - * make sure that REF_CLK is turned on. - */ - regmap_update_bits(imx_pcie->iomuxc_gpr, offset, - IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE, - 0); - regmap_update_bits(imx_pcie->iomuxc_gpr, offset, - IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE_EN, - IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE_EN); - break; + IMX6Q_GPR1_PCIE_REF_CLK_EN, IMX6Q_GPR1_PCIE_REF_CLK_EN); + } else { + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, + IMX6Q_GPR1_PCIE_REF_CLK_EN, 0); + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, + IMX6Q_GPR1_PCIE_TEST_PD, IMX6Q_GPR1_PCIE_TEST_PD); } - return ret; + return 0; } -static void imx_pcie_disable_ref_clk(struct imx_pcie *imx_pcie) +static int imx8mm_pcie_set_ref_clk(struct imx_pcie *imx_pcie, bool enable) { - switch (imx_pcie->drvdata->variant) { - case IMX6QP: - case IMX6Q: - regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, - IMX6Q_GPR1_PCIE_REF_CLK_EN, 0); - regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, - IMX6Q_GPR1_PCIE_TEST_PD, - IMX6Q_GPR1_PCIE_TEST_PD); - break; - case IMX7D: - regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, - IMX7D_GPR12_PCIE_PHY_REFCLK_SEL, - IMX7D_GPR12_PCIE_PHY_REFCLK_SEL); - break; - default: - break; - } + int offset = imx_pcie_grp_offset(imx_pcie); + + /* Set the over ride low and enabled make sure that REF_CLK is turned on.*/ + regmap_update_bits(imx_pcie->iomuxc_gpr, offset, IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE, + enable ? 0 : IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE); + regmap_update_bits(imx_pcie->iomuxc_gpr, offset, IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE_EN, + enable ? IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE_EN : 0); + return 0; +} + +static int imx7d_pcie_set_ref_clk(struct imx_pcie *imx_pcie, bool enable) +{ + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX7D_GPR12_PCIE_PHY_REFCLK_SEL, + enable ? 0 : IMX7D_GPR12_PCIE_PHY_REFCLK_SEL); + return 0; } static int imx_pcie_clk_enable(struct imx_pcie *imx_pcie) @@ -668,10 +646,12 @@ static int imx_pcie_clk_enable(struct imx_pcie *imx_pcie) if (ret) return ret; - ret = imx_pcie_enable_ref_clk(imx_pcie); - if (ret) { - dev_err(dev, "unable to enable pcie ref clock\n"); - goto err_ref_clk; + if (imx_pcie->drvdata->set_ref_clk) { + ret = imx_pcie->drvdata->set_ref_clk(imx_pcie, true); + if (ret) { + dev_err(dev, "unable to enable pcie ref clock\n"); + goto err_ref_clk; + } } /* allow the clocks to stabilize */ @@ -686,7 +666,8 @@ static int imx_pcie_clk_enable(struct imx_pcie *imx_pcie) static void imx_pcie_clk_disable(struct imx_pcie *imx_pcie) { - imx_pcie_disable_ref_clk(imx_pcie); + if (imx_pcie->drvdata->set_ref_clk) + imx_pcie->drvdata->set_ref_clk(imx_pcie, false); clk_bulk_disable_unprepare(imx_pcie->drvdata->clks_cnt, imx_pcie->clks); } @@ -1462,6 +1443,7 @@ static const struct imx_pcie_drvdata drvdata[] = { .mode_off[0] = IOMUXC_GPR12, .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, .init_phy = imx_pcie_init_phy, + .set_ref_clk = imx6q_pcie_set_ref_clk, }, [IMX6SX] = { .variant = IMX6SX, @@ -1476,6 +1458,7 @@ static const struct imx_pcie_drvdata drvdata[] = { .mode_off[0] = IOMUXC_GPR12, .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, .init_phy = imx6sx_pcie_init_phy, + .set_ref_clk = imx6sx_pcie_set_ref_clk, }, [IMX6QP] = { .variant = IMX6QP, @@ -1491,6 +1474,7 @@ static const struct imx_pcie_drvdata drvdata[] = { .mode_off[0] = IOMUXC_GPR12, .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, .init_phy = imx_pcie_init_phy, + .set_ref_clk = imx6q_pcie_set_ref_clk, }, [IMX7D] = { .variant = IMX7D, @@ -1503,6 +1487,7 @@ static const struct imx_pcie_drvdata drvdata[] = { .mode_off[0] = IOMUXC_GPR12, .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, .init_phy = imx7d_pcie_init_phy, + .set_ref_clk = imx7d_pcie_set_ref_clk, }, [IMX8MQ] = { .variant = IMX8MQ, @@ -1516,6 +1501,7 @@ static const struct imx_pcie_drvdata drvdata[] = { .mode_off[1] = IOMUXC_GPR12, .mode_mask[1] = IMX8MQ_GPR12_PCIE2_CTRL_DEVICE_TYPE, .init_phy = imx8mq_pcie_init_phy, + .set_ref_clk = imx8mm_pcie_set_ref_clk, }, [IMX8MM] = { .variant = IMX8MM, @@ -1527,6 +1513,7 @@ static const struct imx_pcie_drvdata drvdata[] = { .clks_cnt = ARRAY_SIZE(imx8mm_clks), .mode_off[0] = IOMUXC_GPR12, .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, + .set_ref_clk = imx8mm_pcie_set_ref_clk, }, [IMX8MP] = { .variant = IMX8MP, @@ -1538,6 +1525,7 @@ static const struct imx_pcie_drvdata drvdata[] = { .clks_cnt = ARRAY_SIZE(imx8mm_clks), .mode_off[0] = IOMUXC_GPR12, .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, + .set_ref_clk = imx8mm_pcie_set_ref_clk, }, [IMX95] = { .variant = IMX95, @@ -1564,6 +1552,7 @@ static const struct imx_pcie_drvdata drvdata[] = { .mode_mask[1] = IMX8MQ_GPR12_PCIE2_CTRL_DEVICE_TYPE, .epc_features = &imx8m_pcie_epc_features, .init_phy = imx8mq_pcie_init_phy, + .set_ref_clk = imx8mm_pcie_set_ref_clk, }, [IMX8MM_EP] = { .variant = IMX8MM_EP, @@ -1575,6 +1564,7 @@ static const struct imx_pcie_drvdata drvdata[] = { .mode_off[0] = IOMUXC_GPR12, .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, .epc_features = &imx8m_pcie_epc_features, + .set_ref_clk = imx8mm_pcie_set_ref_clk, }, [IMX8MP_EP] = { .variant = IMX8MP_EP, @@ -1586,6 +1576,7 @@ static const struct imx_pcie_drvdata drvdata[] = { .mode_off[0] = IOMUXC_GPR12, .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, .epc_features = &imx8m_pcie_epc_features, + .set_ref_clk = imx8mm_pcie_set_ref_clk, }, [IMX95_EP] = { .variant = IMX95_EP, From patchwork Tue Feb 27 21:47:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 207456 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2983804dyb; Tue, 27 Feb 2024 13:49:42 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWxFud9Qy7CX/3Ps0ZPceeRoAaNlPpzkfI+0TR4MQkF15loIwQJl7I/xsX+ORv4PcRrm2hDTdZoBeJTIQpYkk/fm2DEDw== X-Google-Smtp-Source: AGHT+IF11kDsOgX/8OKbXdw/ScZ3bS0jYg+4lBMUaUQ30q9HvVe45v2mtBTaSe+ycP4vn13nY9cD X-Received: by 2002:a17:906:c419:b0:a3f:421:26a5 with SMTP id u25-20020a170906c41900b00a3f042126a5mr611178ejz.12.1709070582042; Tue, 27 Feb 2024 13:49:42 -0800 (PST) Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id sa8-20020a1709076d0800b00a43f1feac19si49449ejc.554.2024.02.27.13.49.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 13:49:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-84068-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=gCw03z1j; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-84068-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84068-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 7112F1F26D5A for ; Tue, 27 Feb 2024 21:49:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 20E6B1586DC; Tue, 27 Feb 2024 21:48:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="gCw03z1j" Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2088.outbound.protection.outlook.com [40.107.21.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7AD07154BF5; Tue, 27 Feb 2024 21:47:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.88 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709070481; cv=fail; b=mKtNa7dVYxzv1NTFdV3GvNX2ACoGQACCuhHDpgLNrbLIZi8UGWtMGRMjlJwRGqghh32Y5OLnSBB+jhNfOzybD8T/5rM4/DQdf56693S0T48CAN3hRJpSzLszToi72TBA7iuPDMzxg4zINGfI3dRwFAdXhTkzJVHamONVLXxrB7M= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709070481; c=relaxed/simple; bh=G9EHK/0mVHaUz9zEpQNHxMoHdNZEcg1Av5M6Mp8X4CE=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=o7A2g4MgRL1Zbf2B/Qq0svjiqh21VKiPM0IfdtBlxm7QTRI2n/v113oPcdu9yBTT67NqOuQFeFho+TNfjEeFAIFmpTTgyUSDwa/VhKOz4yZWLvMiHOvCIDHstBlHMbqFerzP1ftCaGiJ92FO2Z5KjBrmwAIHLryJbGjuP4m2Xlo= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=gCw03z1j; arc=fail smtp.client-ip=40.107.21.88 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R9ZmV9JNz6zsI40rC6f0hbEoKHqdSUFzK8PydFXWZFhsb51OLO/uDD1d0OUCr6tOgFfsq/89vcB7yVfsa7HbpREprhyKowBZLDKKPo4vZBvMqGBRDXhj2n51qbsmKW/Y0VPzGE4dCMIdL2cIMG4XjaX0Muy73ov1ytBAwOWxskbsW+g+CnZGcsAHrmn/knGhJJzWdCmZOS88l9icbo6sHeSq1TOneZeQfZsJcJNVJe6VELizgLeR0f9k/AJ0nGGTj/S3fv0ZmPnxIjieMc7rc/2bQOaQUXa0WNYi7dCidjkT9EESwSufCsQQXRcXz39p/x5DgafJkc5V499kswij1Q== 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=zdrOYJZj22EFcaBPN4ILSseZjQCAK4Lfh/z6ZIVrliY=; b=lq0L+AWgiMngMUSNQ4HykBnGNC1XEOiZH6D2id2YMxvwNoNbJEJIacSLN/2qqPwyyqSIVDp1rvGaFsQMwGvx/23xE7/48T58w7LwklIOBrVKz/9F6/tX9wQYKR1gZvS/VbebnUZA/X4v6j+4Ba40F2BdAqSrZB/k6mNjTlKvEtRAyoCwX+9anu5zCHezdkrX/KgKE4sQ8ZnDG3rt3l18WMsRWvgcOfPPOxzfdvaE3PNkr26yK5idMmHlSsUaBKfwrK0iFprtqeBFaYPmMGe/KguwGywVu73SWcCzpRbNq8lgDe5z3VGavLnahgnH/CpxY9qnqA4txrfaxqmbilCn4A== 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=zdrOYJZj22EFcaBPN4ILSseZjQCAK4Lfh/z6ZIVrliY=; b=gCw03z1j055XG39Fyz5nxfVoMMH2nfn/HCrn4z5bMm2iW2g56PPlwH8aKCcNG5pRPA3JA+6q64MvoJZOid5zd0PUIPWVOHCkHmUPTRGTYyNW8rMw34V7yej7suSTsK+N1dDxnRwE6Q562QIutKV9IuZBefjsBaay97pXZ1DTWrM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by VI1PR04MB7056.eurprd04.prod.outlook.com (2603:10a6:800:12c::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.36; Tue, 27 Feb 2024 21:47:56 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9af4:87e:d74:94aa]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9af4:87e:d74:94aa%7]) with mapi id 15.20.7316.035; Tue, 27 Feb 2024 21:47:56 +0000 From: Frank Li Date: Tue, 27 Feb 2024 16:47:12 -0500 Subject: [PATCH 5/6] PCI: imx: Simplify switch-case logic by involve core_reset callback Message-Id: <20240227-pci2_upstream-v1-5-b952f8333606@nxp.com> References: <20240227-pci2_upstream-v1-0-b952f8333606@nxp.com> In-Reply-To: <20240227-pci2_upstream-v1-0-b952f8333606@nxp.com> To: Richard Zhu , Lucas Stach , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Rob Herring , Bjorn Helgaas , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Philipp Zabel , Liam Girdwood , Mark Brown Cc: linux-pci@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, Frank Li X-Mailer: b4 0.13-dev-c87ef X-Developer-Signature: v=1; a=ed25519-sha256; t=1709070448; l=7121; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=G9EHK/0mVHaUz9zEpQNHxMoHdNZEcg1Av5M6Mp8X4CE=; b=K+bYLRnhH0hLmty0PqWm//qiHkHDSiODBa1PtVdMj+cGFjNezoYzFmDhnDb7e3sHhOl/B/mkj kS7rUDR6uFeCcmL9ZDUXQakhwoh8Hh0a5MRaCJ6jHZbyMEGSrwaxWH1 X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR11CA0050.namprd11.prod.outlook.com (2603:10b6:a03:80::27) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|VI1PR04MB7056:EE_ X-MS-Office365-Filtering-Correlation-Id: a63c23e6-4fe2-4d5d-4237-08dc37ddc215 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: e0FRoCCgKe1LhdiEoOz0xHuFVLBuVc+0GoRp1N4M7XTP44QjughPCPWo0ymx0hvQAl9tmUfV/+xZF6ozjX1WgTfN3tc2rejxO5tauxpVlpwGR42t+L58hBX/GuCTc1QLpx/DnlMYgdLY9PlE6YLHfH8sG1uab1fFmai0OivYJ6bHe4b9khwTIsBvHJrUQ193z1qo4eWwjA9e3JSrPOUjZYlQ534MffTm2Cmrhq0LOD7v5pXBoWwtMRSEAqVly/Tom2bkSFhqx+rGMMm/RG3E5G76Xrd7rE9enFcqsHTX3jaBPq5Lwg+iO9A1tJ7GDwBPEb7dRhQBdDIcthH+Omyefn30nZAorWC2vbWxbflS+MKZ2eJqIdnudNfMydZW1rIbBmUX9cDJtB2gp90L/iSaTqgsP43GvOMXOZRdFSgxqBx6XF+YudOFGZ033mnaTzVk07gSFTrn3kaLiEBadLB0cfADaMETyHM4e+EEiyYCTCiz/f5+i2iIwB/5qixHHqwhyT1HxSw2ZbiBiGJqmEI/aaRWEiPOKvm8nm/LEuMqPrdUW9cqch03JY9AYJlpyUMBqkwo+PxFK7tAf5vzJBPW+ECCLM0wjtHn5XrUgNbt1fHIJP0EisffPWdPWPq+MCJVzVS6/INIAvNzVpZYZefLQxiDQ5yjRsshFecVKzWR9J25w780bqqIjGqRH8/Md/35Ux1y19Ml3XWoQpd3d0yKyx7b7GD1d4z6S1YuCGXL9CQ= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(921011)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?yjyEJeU/2neelYYgG1fBtN4bXE8K?= =?utf-8?q?f4pbyjfW/+iC1+ju+qcV8Y20DyRkEUAU3aRyT58agQJt0gNXHRwWC6c1/bQ8T88aM?= =?utf-8?q?qi8zUOL0uE93VdWv9CypWQ4ZTImP2U6uL4UulfB+egDjlBbpEuzdWmauPr/bgPd1q?= =?utf-8?q?s8UoPoU/Ti6JTOdJPce1KkD+OOOlHfUsZs7dx7sRN3x5M08BkOli8B1oN+hUA+9rJ?= =?utf-8?q?Mqjt9bh097hZ538ylwC2gYXXlZxB848IMC+vbgpYFUkTuna0llnZ3j89zQRO8KSjk?= =?utf-8?q?nY0+Ys1y7lSBZUFazW7AtN/GAPgYjesQ8gslQplYWwmqPh6L99pcGQRlPVs1WalbS?= =?utf-8?q?te2pKsuL1k3+1lk+lAqP6NPp7t6DmtfJMFFhBI+k3Jp5AMV8N+b/E6OmgskDqYNB4?= =?utf-8?q?KbBHyZU8YsQ5S7uopQOUvMo73WQZKMGufSlZ0jtVMhK1N6a9ntAbNUa2KX/xeT10t?= =?utf-8?q?Ch7vzP8SvSrjwoXiVFGgaK89dNplYKAvM53r4qJ26Rfj5PolqahiU5bedlwsJTj6A?= =?utf-8?q?l4FMRo7SzYwtgg3ioSRTI1mrN+oI7DoKQSAeSzlZiy/CM7M6Vh7lHR+C3DUO1Or2F?= =?utf-8?q?GjD3Z7UqaehajSMZMXm+EYXQp6SntJwnmGXE+AVDCXWneTdC0ZGlHNB5jn2Qw0GD1?= =?utf-8?q?HyRT/d8bHz2qHf6eqbnf7mAhuJtPPIQiKQ8bRZAnXGDqXozOShUM5M/ndBQsGvl1t?= =?utf-8?q?NHsGlyA6O2lxPCRPGf14XpkfSTq+76S5qfw3GBJCtph9JSwFxoKwfDTsxaXvaaUJL?= =?utf-8?q?BketI0Ucf3m86Fyw6vZQ/0cWcF0yUgW32uUeL78aI2lmJyNE8PcMTKD1HuuQwpopB?= =?utf-8?q?vx90zUkLp5MbGTO5WEjpK2ChG3J6aHs4PWdUYgDqmpq+LQwvA/GrvzrmKWh+36QLj?= =?utf-8?q?da3uDUhfCAsHrPfqfzEtJrEu+44/sQb3E78oFEfhcXAmuZRntQvRmCXlbJOw965S1?= =?utf-8?q?8sG94yP3vtOL8w+P0cc3sl0USLAzqdOmm/Xx6OHp6Zg+MrgcJEa5iXyhL24PCxrNK?= =?utf-8?q?7V4wCZHljTYKN1Kgr0ybOnXuPSUrrhhQ8jZtquHIDbstC59XQwK3iVHPo7tPY2duG?= =?utf-8?q?BbQwAIHdCIOyPAjZDdY2tIIAJ2b7Ptx9vUYZc4HnU5KwA5KrRyp5K3EUA+kdbCNn8?= =?utf-8?q?XV5vXUR/veenwhAsjgkDHXqnBmOsir8FkGl79f60js5mzC/ZMuccIAYM7+5DIJrCS?= =?utf-8?q?Bzb7+A8iTdEItmLvGpcODMHhYzktmWHgZaOLVRmH03v39qVgCVBgciD+5udgaPWjw?= =?utf-8?q?RpX6eb2KvewbbN5lanjnDJHpUbEk3PcTJpvw3upWn/1TWMzvmbpKFr4HawBtK4QUY?= =?utf-8?q?J+WeGMUOAtF9WQR5bEpHmCQiQ/yO4hDMZ3FvEOqMOHCWR+CzijA94+JI//1qW8aCm?= =?utf-8?q?oGZdYCrlg3yGZax/LLBaFF2KYkWgzHQ3/1ulZIe3P8Ly9T5P2/unjciXgRj+WckuC?= =?utf-8?q?gfttr3EaVm4NRDkdRPzj7O7rXndtFy0ORwU1r4FslqOQiBQR1Rv+iuH+HzCAcLSaB?= =?utf-8?q?6+CjRdnS9Ffs?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a63c23e6-4fe2-4d5d-4237-08dc37ddc215 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Feb 2024 21:47:56.4482 (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: raxxcEE1xBBdwBPf/0HjDCRJHeRrm6f9M+hjpL1G0u/EXoidgkRDrzZkU13h5nYP6EdVMnUoRzzW7TM59wnS4g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB7056 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792090394585926937 X-GMAIL-MSGID: 1792090394585926937 Instead of using the switch case statement to assert/dassert the core reset handled by this driver itself, let's introduce a new callback core_reset() and define it for platforms that require it. This simplifies the code. Signed-off-by: Frank Li --- drivers/pci/controller/dwc/pci-imx.c | 131 ++++++++++++++++++----------------- 1 file changed, 68 insertions(+), 63 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx.c b/drivers/pci/controller/dwc/pci-imx.c index a63ce171ede8f..460d40115935b 100644 --- a/drivers/pci/controller/dwc/pci-imx.c +++ b/drivers/pci/controller/dwc/pci-imx.c @@ -104,6 +104,7 @@ struct imx_pcie_drvdata { const struct pci_epc_features *epc_features; int (*init_phy)(struct imx_pcie *pcie); int (*set_ref_clk)(struct imx_pcie *pcie, bool enable); + int (*core_reset)(struct imx_pcie *pcie, bool assert); }; struct imx_pcie { @@ -671,35 +672,72 @@ static void imx_pcie_clk_disable(struct imx_pcie *imx_pcie) clk_bulk_disable_unprepare(imx_pcie->drvdata->clks_cnt, imx_pcie->clks); } +static int imx6sx_pcie_core_reset(struct imx_pcie *imx_pcie, bool assert) +{ + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX6SX_GPR12_PCIE_TEST_POWERDOWN, + assert ? IMX6SX_GPR12_PCIE_TEST_POWERDOWN : 0); + /* Force PCIe PHY reset */ + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR5, IMX6SX_GPR5_PCIE_BTNRST_RESET, + assert ? IMX6SX_GPR5_PCIE_BTNRST_RESET : 0); + return 0; +} + +static int imx6qp_pcie_core_reset(struct imx_pcie *imx_pcie, bool assert) +{ + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, IMX6Q_GPR1_PCIE_SW_RST, + assert ? IMX6Q_GPR1_PCIE_SW_RST : 0); + if (!assert) + usleep_range(200, 500); + + return 0; +} + +static int imx6q_pcie_core_reset(struct imx_pcie *imx_pcie, bool assert) +{ + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, IMX6Q_GPR1_PCIE_TEST_PD, + assert ? IMX6Q_GPR1_PCIE_TEST_PD : 0); + + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, IMX6Q_GPR1_PCIE_REF_CLK_EN, + assert ? 0 : IMX6Q_GPR1_PCIE_REF_CLK_EN); + + return 0; +} + +static int imx7d_pcie_core_reset(struct imx_pcie *imx_pcie, bool assert) +{ + struct dw_pcie *pci = imx_pcie->pci; + struct device *dev = pci->dev; + + if (assert) + return 0; + + /* + * Workaround for ERR010728, failure of PCI-e PLL VCO to oscillate, especially when cold. + * This turns off "Duty-cycle Corrector" and other mysterious undocumented things. + */ + + if (likely(imx_pcie->phy_base)) { + /* De-assert DCC_FB_EN */ + writel(PCIE_PHY_CMN_REG4_DCC_FB_EN, imx_pcie->phy_base + PCIE_PHY_CMN_REG4); + /* Assert RX_EQS and RX_EQS_SEL */ + writel(PCIE_PHY_CMN_REG24_RX_EQ_SEL | PCIE_PHY_CMN_REG24_RX_EQ, + imx_pcie->phy_base + PCIE_PHY_CMN_REG24); + /* Assert ATT_MODE */ + writel(PCIE_PHY_CMN_REG26_ATT_MODE, imx_pcie->phy_base + PCIE_PHY_CMN_REG26); + } else { + dev_warn(dev, "Unable to apply ERR010728 workaround. DT missing fsl,imx7d-pcie-phy phandle ?\n"); + } + imx7d_pcie_wait_for_phy_pll_lock(imx_pcie); + return 0; +} + static void imx_pcie_assert_core_reset(struct imx_pcie *imx_pcie) { reset_control_assert(imx_pcie->pciephy_reset); reset_control_assert(imx_pcie->apps_reset); - switch (imx_pcie->drvdata->variant) { - case IMX6SX: - regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, - IMX6SX_GPR12_PCIE_TEST_POWERDOWN, - IMX6SX_GPR12_PCIE_TEST_POWERDOWN); - /* Force PCIe PHY reset */ - regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR5, - IMX6SX_GPR5_PCIE_BTNRST_RESET, - IMX6SX_GPR5_PCIE_BTNRST_RESET); - break; - case IMX6QP: - regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, - IMX6Q_GPR1_PCIE_SW_RST, - IMX6Q_GPR1_PCIE_SW_RST); - break; - case IMX6Q: - regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, - IMX6Q_GPR1_PCIE_TEST_PD, 1 << 18); - regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, - IMX6Q_GPR1_PCIE_REF_CLK_EN, 0 << 16); - break; - default: - break; - } + if (imx_pcie->drvdata->core_reset) + imx_pcie->drvdata->core_reset(imx_pcie, true); /* Some boards don't have PCIe reset GPIO. */ if (gpio_is_valid(imx_pcie->reset_gpio)) @@ -709,47 +747,10 @@ static void imx_pcie_assert_core_reset(struct imx_pcie *imx_pcie) static int imx_pcie_deassert_core_reset(struct imx_pcie *imx_pcie) { - struct dw_pcie *pci = imx_pcie->pci; - struct device *dev = pci->dev; - reset_control_deassert(imx_pcie->pciephy_reset); - switch (imx_pcie->drvdata->variant) { - case IMX7D: - /* Workaround for ERR010728, failure of PCI-e PLL VCO to - * oscillate, especially when cold. This turns off "Duty-cycle - * Corrector" and other mysterious undocumented things. - */ - if (likely(imx_pcie->phy_base)) { - /* De-assert DCC_FB_EN */ - writel(PCIE_PHY_CMN_REG4_DCC_FB_EN, - imx_pcie->phy_base + PCIE_PHY_CMN_REG4); - /* Assert RX_EQS and RX_EQS_SEL */ - writel(PCIE_PHY_CMN_REG24_RX_EQ_SEL - | PCIE_PHY_CMN_REG24_RX_EQ, - imx_pcie->phy_base + PCIE_PHY_CMN_REG24); - /* Assert ATT_MODE */ - writel(PCIE_PHY_CMN_REG26_ATT_MODE, - imx_pcie->phy_base + PCIE_PHY_CMN_REG26); - } else { - dev_warn(dev, "Unable to apply ERR010728 workaround. DT missing fsl,imx7d-pcie-phy phandle ?\n"); - } - - imx7d_pcie_wait_for_phy_pll_lock(imx_pcie); - break; - case IMX6SX: - regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR5, - IMX6SX_GPR5_PCIE_BTNRST_RESET, 0); - break; - case IMX6QP: - regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, - IMX6Q_GPR1_PCIE_SW_RST, 0); - - usleep_range(200, 500); - break; - default: - break; - } + if (imx_pcie->drvdata->core_reset) + imx_pcie->drvdata->core_reset(imx_pcie, false); /* Some boards don't have PCIe reset GPIO. */ if (gpio_is_valid(imx_pcie->reset_gpio)) { @@ -1444,6 +1445,7 @@ static const struct imx_pcie_drvdata drvdata[] = { .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, .init_phy = imx_pcie_init_phy, .set_ref_clk = imx6q_pcie_set_ref_clk, + .core_reset = imx6q_pcie_core_reset, }, [IMX6SX] = { .variant = IMX6SX, @@ -1459,6 +1461,7 @@ static const struct imx_pcie_drvdata drvdata[] = { .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, .init_phy = imx6sx_pcie_init_phy, .set_ref_clk = imx6sx_pcie_set_ref_clk, + .core_reset = imx6sx_pcie_core_reset, }, [IMX6QP] = { .variant = IMX6QP, @@ -1475,6 +1478,7 @@ static const struct imx_pcie_drvdata drvdata[] = { .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, .init_phy = imx_pcie_init_phy, .set_ref_clk = imx6q_pcie_set_ref_clk, + .core_reset = imx6qp_pcie_core_reset, }, [IMX7D] = { .variant = IMX7D, @@ -1488,6 +1492,7 @@ static const struct imx_pcie_drvdata drvdata[] = { .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, .init_phy = imx7d_pcie_init_phy, .set_ref_clk = imx7d_pcie_set_ref_clk, + .core_reset = imx7d_pcie_core_reset, }, [IMX8MQ] = { .variant = IMX8MQ, From patchwork Tue Feb 27 21:47:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 207457 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2983884dyb; Tue, 27 Feb 2024 13:49:55 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVO/zOArdiYq/vlTNSuGCcSj6LZKIl4ex0nKHyvcQ4SrEIRvipfeRFyFjYuLDlL/+/GkIsY8IIzrsKJdiaBz+omZknYaw== X-Google-Smtp-Source: AGHT+IHuBv2eI1vK6OkBcQr3+FZY1tPtRFElzjyamL2wKop87pmsQpphNETMQr2/i9HuyYU4We1v X-Received: by 2002:a05:6808:189c:b0:3c1:adc7:5464 with SMTP id bi28-20020a056808189c00b003c1adc75464mr3520860oib.43.1709070595431; Tue, 27 Feb 2024 13:49:55 -0800 (PST) Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id it17-20020a056a00459100b006e08bc19c82si6027583pfb.82.2024.02.27.13.49.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 13:49:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-84069-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=CTSl7SWH; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-84069-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84069-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 3839C289551 for ; Tue, 27 Feb 2024 21:49:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 64D081586E7; Tue, 27 Feb 2024 21:48:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="CTSl7SWH" Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2076.outbound.protection.outlook.com [40.107.21.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B04AA157E98; Tue, 27 Feb 2024 21:48:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.76 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709070485; cv=fail; b=pKByE5VDXQyLKt1ypJSMhFDPV/TzCEC33ufIRuXVYTiDpY/sCCs19P+psQTRTpTLhxzpHzC3z95fzsWmI9qOK6X7F49f4IK1iCD071AK7Zp3+IERz0WFh64KAYpzSangFawOKZyycWthJ60HR6KgKHmtr3Vi2G4DvoLQ3MdeuAU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709070485; c=relaxed/simple; bh=j1GdxC5Qcy58j0c4EpqjxH7NIOJFweXArDeCv3j1l98=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=I7yzeJDdPYSAgN+azlzpZeLVfmLAegC1KsZLzWPn+BPDDTGrNjoa5T2c8dlQN+XJoAQhcNViX5RPOJi6Vk7Y0xZyP1Ztn1oRUU8FJ5NiqWKKAmLImnuKis64iuLcbtpm3R99lgfiDD1XLHJJLBz8T1u88bghQV4CpZ1ZZ/A+Xhg= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=CTSl7SWH; arc=fail smtp.client-ip=40.107.21.76 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OJFn6GWcnfhMQioTmuBhYJklNI2GhqAgD8KH8HxVrQx7wYNK7ucmuRtkOKOQwbrf+q3cEB6+g+41G4Gf7cKOqnN7RuzWuduOKcRTJQhXjcem0I7P6bss82+IbvUc/ZEZ3leWq3a2QQjHpJHEbMFhLqGjNN6rv60mV75BC587xWZdmJA60x/vCslfRioipKnSglj0oTaKVsB0tOkmKl/uzfVgpmVIw88G0obWdTyoMsoRGgODXnnSeYjUyf06QL0emcF1oU5684k8PbIjfdCyPjdABsNQl1EQyErLzMlqHpDjyDat35ORDeQMTzeCTFEQrsnV4iHlToI2ZrAjflNV7w== 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=bWeg1pQ1G2vVPLsLAxibEtEDU4i/0SULIxIVfA5qIDg=; b=c1S542zcx6O+u/V3LscOsxeXo9TMWQ7TceCvrCzrb2TSd+MoTLhDJRsyucIo57pfkImK2POLbCbWQoh1Y7nStXGYB7kzT7qhyDzMjHUFw2cAs/saJ2LZRpFqm+D476XNvijvTkhifben2fV2W6fccTVqLolWcOiytdVLE70nCpkKS737k+URrZhmZnvaeg5w1pNKsE5luvKv1xbJdJffXbMEmFqL6h3irnezgOB2cfFCb8U2DBcfz2XH+HNLS966G7noN5lDD8iccxus0m5mGbARO9GSXZJ9fi+iNGKdMK2JbLwh7lROZ3O7Ui4+S6VefFjd9IYDYsvBDKos97tZCg== 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=bWeg1pQ1G2vVPLsLAxibEtEDU4i/0SULIxIVfA5qIDg=; b=CTSl7SWHVrHYMMoBY9uIN0SvkdBpT3oE5vIFa9f35Dxm6fjtBK5QHRUB9hyE5/Bs5BtAXnXVdR21jaXdEVFMCEbZ1dfJypd0Bfo+nZHeLtYpKYrQE1tUHkKX3o8aZ2pXkYzMQd6ZcUHJlP0zxpdyxaMn+QS5WBhdbuQh2NNjrZs= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by VI1PR04MB7056.eurprd04.prod.outlook.com (2603:10a6:800:12c::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.36; Tue, 27 Feb 2024 21:48:01 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9af4:87e:d74:94aa]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9af4:87e:d74:94aa%7]) with mapi id 15.20.7316.035; Tue, 27 Feb 2024 21:48:01 +0000 From: Frank Li Date: Tue, 27 Feb 2024 16:47:13 -0500 Subject: [PATCH 6/6] PCI: imx: Config look up table(LUT) to support MSI ITS and IOMMU for i.MX95 Message-Id: <20240227-pci2_upstream-v1-6-b952f8333606@nxp.com> References: <20240227-pci2_upstream-v1-0-b952f8333606@nxp.com> In-Reply-To: <20240227-pci2_upstream-v1-0-b952f8333606@nxp.com> To: Richard Zhu , Lucas Stach , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Rob Herring , Bjorn Helgaas , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Philipp Zabel , Liam Girdwood , Mark Brown Cc: linux-pci@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, Frank Li X-Mailer: b4 0.13-dev-c87ef X-Developer-Signature: v=1; a=ed25519-sha256; t=1709070448; l=5955; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=j1GdxC5Qcy58j0c4EpqjxH7NIOJFweXArDeCv3j1l98=; b=sHLG+MjI1/M5kIP42sIEZSrD+trv43x5+K47RWBnrNp91fOrTJvP3S9ztBit9i7BvDPkvYi1Y DUI5wS7esjHDGC5VdD7QjbLeJj67kIYtry3dLfFkt+ZSS2ar4NwwfKO X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR11CA0050.namprd11.prod.outlook.com (2603:10b6:a03:80::27) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|VI1PR04MB7056:EE_ X-MS-Office365-Filtering-Correlation-Id: e6fee768-fae2-4f58-8f2c-08dc37ddc4da X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 31n3bae9EW3Ni+cp3+O5te+D1u0wxMJb7qjXKVhH35XHmNZe4vIehIasr2SnGxRsevDmZFJ4BzIuuzVfLNLg4hQt2EzKWjl0OujgNh+FjdmnPckTlfeI1cHi0uxxqkymUEHFfq9uM2fNVDPCPKN0WN0ps/TTkoOh+gaQr3a9RLSrQOwv+nAUzhwSNEHgiZAo/cDmMzR2y9plmJJkBrnAb9NYlnOzPFuxOrZKMrMWEY3NcZz5OihQve4OmjXZpS1sah2hceaHxkxKP+oqGIMnkwxdO/pSY2ejnOZn77fpQfvw4HX0DO9z9YMMuDd1fbHNuIHXTS/p+q5RQF34as1Hy9HqGiqRea7fdt6LwWH+2Ma2eT0ejjFaJqy2cn9WV/dnBNZHWLx6Y8cuHDuvslgDsQWVWH+IrHqXaLngGzVcRAo+p5Q8b5FDWiKJAf3izPfPfLBVQIZ/aGUeZFN5ye3WkzO6PxU05q1JTSqKC1NYk4kCT6P1sLBEJ35oN2gpi5tipUT8m9jPVOZcwG1wufptsCznR3m2p4NAIXscrQFAlM2Wfm8Pg7G0MXGhsse6v9C1+bpAAnx6MPucaV16LOMccbUxMZ5Zc+1gsi3AcZI/4EjD2E02Taqv+oYlZm0ryLLp5EWu1Z1RifUDT27aWcOJpt08mMoYDVzZi4TkNOJAgxCeyk48XXcV5BixN0QGm8mHkbXC0sGxVfxq+krdBWjAGqaLZhay7ZRfMprmwXxkQfo= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(921011)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?9lYWGHgWk9Eb1O/TkeEz0aAEovPa?= =?utf-8?q?SC8eJnW5PGBF5SYor5/uxkhuj0N4SfPcSmeqipUGMSdpS1lAAm3Xe8uYWZxya/a6Z?= =?utf-8?q?jmAA+GWZzv8Z8mWTrxz5qZIGOnf+GTdhsSt0H95M2/lU4R2pEG87m7JscBMt1nLpt?= =?utf-8?q?ki+evkg1t0EiXeUEJfmpeNuaEiAzFrTY4YiCa68B0PQDaoS+VFc2cH9PWpilr1swP?= =?utf-8?q?pWmmHavqPhhzJK3SYAeornMl5vrhXTdzf9761vxxpavc6lmzeCDkozXYRB1K9xnXj?= =?utf-8?q?5lT9zU32nkcWZYi3s+4GFMX5UK1CjBpRKYYCuGwCJ3sSnd7XviBB6g+k1DcLonKaS?= =?utf-8?q?NYxvljFqH+lHIgRuWObUJR3gOPqOUUW/eDrKzPi15NuCTmTFY5K77ypTAt5VBDpjK?= =?utf-8?q?6aOF9kwFniZgitHqYoDM8vLqMTL49yknHFewWpZYi+xH/JH03B0FbRe+Qg1p3epyq?= =?utf-8?q?BATR6yKpJXDfHLIo4u5bHeP99hh3SRmMHLuA9qPH+UebaccW/iGPyJzXof6CgjLH7?= =?utf-8?q?Nb1NCtkALfTDG7rc9nKoklZzJNFrdz3xKtr1CgXiMzI+n3mRqBmmW3CM3YCMO8PxY?= =?utf-8?q?P9Y+GO9jAi+Kr8JVMnlBMU2O1ZlTpzLgEeA9MXHfWJOtV1YDPzsEEQ8eZwAsjPz8D?= =?utf-8?q?orv75WkX130hmvi/zEDfpXpoLwBrCaJDiGGKbdMSLtoUcIDNi2ivtMV/7KETvOkYQ?= =?utf-8?q?CaBZUJUoLS4LY6s7aMpop+YhcbjlTZIwvEHNT6+UT6sBzU9b8DQt+2olatlkZ9/3Y?= =?utf-8?q?KnUsr31rpQpg4dtNcGLv1t3tEXtAL5u1ycnegE148fiT5ob25FU8HbwMgROwVFPZd?= =?utf-8?q?OFGjEcUsZ2+GANbkukKFHsrePvMqiC9TUbmDsu8y4GhdKn4Dkk/z0B7Uw18IE8apH?= =?utf-8?q?5Nar1LzbuPI5G9AFQ8jzUjG13Wsknkh/AzNIy2shpQjZ0zJUmQNhMjoECHnccYUfS?= =?utf-8?q?UNRo/2PlT+YxUhKNyGiX/fFGG1m6nIpaLS3hZAautYNA656JOxAEdaBGrGfY8gNl4?= =?utf-8?q?upiBd0aUM8acqRai1E6ptNkWjjkC++CHIhIq9gQvOX15l8tjPB2LrVF8VuRKK/5Pk?= =?utf-8?q?1VKZ9Tla9z5WaQlX8UbkZMH8zxWiUUlE7ETnsW1ddwpWbe/+D/KVxmCIPJ506cJBZ?= =?utf-8?q?wCps2+aK+kYGRc2VvcvOHjplUYznrv/4WTFO7dT+FPPfYyY71HeYdPrhU6shaem+P?= =?utf-8?q?jKFYCx0DpVNnDMXJUEaXyiXFA7GoVhmP/dkyogBcUXJrEEAjMYhZ2Q8AMXjHXn3Zx?= =?utf-8?q?NeQjHy1buQuqDIcczzcroMAuozrcxrWCbWSaKWhWKRs1qm0lQrM+4JBCrY7FLhFyl?= =?utf-8?q?nCbJzG6ml7DNb+63ygNcB/S/5oc9JHwFGHb2yzpU5/KdI3tbsF5mvZrGyrLQqKpeU?= =?utf-8?q?M0rLK8UWoNQaob9eKdcY0KkOMSJxOiYnMTrnyISw0jc7iWhU2QgURJwbypMvlzkev?= =?utf-8?q?SI5gTQDr4q148JH5ygxDo6tk1T7jXOyUPDmhG3OcAfVqS2sE454OIKswjuFQmknjL?= =?utf-8?q?qy91fFf5/QSa?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e6fee768-fae2-4f58-8f2c-08dc37ddc4da X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Feb 2024 21:48:01.1024 (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: CVCbQr400E1eI/KSwSDLjR5bmR76lcibAlM6MquHH0nxk+rFK31KhhZK/GBpKQhCL2UacY3gMi5oKuNks7Rr2g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB7056 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792090408674241717 X-GMAIL-MSGID: 1792090408674241717 i.MX95 need config LUT to convert bpf to stream id. IOMMU and ITS use the same stream id. Check msi-map and smmu-map and make sure the same PCI bpf map to the same stream id. Then config LUT related registers. Signed-off-by: Frank Li --- drivers/pci/controller/dwc/pci-imx.c | 175 +++++++++++++++++++++++++++++++++++ 1 file changed, 175 insertions(+) diff --git a/drivers/pci/controller/dwc/pci-imx.c b/drivers/pci/controller/dwc/pci-imx.c index 460d40115935b..782555beb6e9d 100644 --- a/drivers/pci/controller/dwc/pci-imx.c +++ b/drivers/pci/controller/dwc/pci-imx.c @@ -55,6 +55,22 @@ #define IMX95_PE0_GEN_CTRL_3 0x1058 #define IMX95_PCIE_LTSSM_EN BIT(0) +#define IMX95_PE0_LUT_ACSCTRL 0x1008 +#define IMX95_PEO_LUT_RWA BIT(16) +#define IMX95_PE0_LUT_ENLOC GENMASK(4, 0) + +#define IMX95_PE0_LUT_DATA1 0x100c +#define IMX95_PE0_LUT_VLD BIT(31) +#define IMX95_PE0_LUT_DAC_ID GENMASK(10, 8) +#define IMX95_PE0_LUT_STREAM_ID GENMASK(5, 0) + +#define IMX95_PE0_LUT_DATA2 0x1010 +#define IMX95_PE0_LUT_REQID GENMASK(31, 16) +#define IMX95_PE0_LUT_MASK GENMASK(15, 0) + +#define IMX95_SID_MASK GENMASK(5, 0) +#define IMX95_MAX_LUT 32 + #define to_imx_pcie(x) dev_get_drvdata((x)->dev) enum imx_pcie_variants { @@ -217,6 +233,159 @@ static int imx95_pcie_init_phy(struct imx_pcie *imx_pcie) return 0; } +static int imx_pcie_update_lut(struct imx_pcie *imx_pcie, int index, u16 reqid, u16 mask, u8 sid) +{ + struct dw_pcie *pci = imx_pcie->pci; + struct device *dev = pci->dev; + u32 data1, data2; + + if (sid >= 64) { + dev_err(dev, "Too big stream id: %d\n", sid); + return -EINVAL; + } + + data1 = FIELD_PREP(IMX95_PE0_LUT_DAC_ID, 0); + data1 |= FIELD_PREP(IMX95_PE0_LUT_STREAM_ID, sid); + data1 |= IMX95_PE0_LUT_VLD; + + regmap_write(imx_pcie->iomuxc_gpr, IMX95_PE0_LUT_DATA1, data1); + + data2 = mask; + data2 |= FIELD_PREP(IMX95_PE0_LUT_REQID, reqid); + + regmap_write(imx_pcie->iomuxc_gpr, IMX95_PE0_LUT_DATA2, data2); + + regmap_write(imx_pcie->iomuxc_gpr, IMX95_PE0_LUT_ACSCTRL, index); + + return 0; +} + +struct imx_of_map { + u32 bdf; + u32 phandle; + u32 sid; + u32 sid_len; +}; + +static int imx_check_msi_and_smmmu(struct imx_pcie *imx_pcie, + struct imx_of_map *msi_map, u32 msi_size, u32 msi_map_mask, + struct imx_of_map *smmu_map, u32 smmu_size, u32 smmu_map_mask) +{ + struct dw_pcie *pci = imx_pcie->pci; + struct device *dev = pci->dev; + int i; + + if (msi_map && smmu_map) { + if (msi_size != smmu_size) + return -EINVAL; + if (msi_map_mask != smmu_map_mask) + return -EINVAL; + + for (i = 0; i < msi_size / sizeof(*msi_map); i++) { + if (msi_map->bdf != smmu_map->bdf) { + dev_err(dev, "bdf setting is not match\n"); + return -EINVAL; + } + if ((msi_map->sid & IMX95_SID_MASK) != smmu_map->sid) { + dev_err(dev, "sid setting is not match\n"); + return -EINVAL; + } + if ((msi_map->sid_len & IMX95_SID_MASK) != smmu_map->sid_len) { + dev_err(dev, "sid_len setting is not match\n"); + return -EINVAL; + } + } + } + + return 0; +} + +/* + * Simple static config lut according to dts settings DAC index and stream ID used as a match result + * of LUT pre-allocated and used by PCIes. + * + * Currently stream ID from 32-64 for PCIe. + * 32-40: first PCI bus. + * 40-48: second PCI bus. + * + * DAC_ID is index of TRDC.DAC index, start from 2 at iMX95. + * ITS [pci(2bit): streamid(6bits)] + * pci 0 is 0 + * pci 1 is 3 + */ +static int imx_pcie_config_sid(struct imx_pcie *imx_pcie) +{ + struct imx_of_map *msi_map = NULL, *smmu_map = NULL, *cur; + int i, j, lut_index, nr_map, msi_size = 0, smmu_size = 0; + u32 msi_map_mask = 0xffff, smmu_map_mask = 0xffff; + struct dw_pcie *pci = imx_pcie->pci; + struct device *dev = pci->dev; + u32 mask; + int size; + + of_get_property(dev->of_node, "msi-map", &msi_size); + if (msi_size) { + msi_map = devm_kzalloc(dev, msi_size, GFP_KERNEL); + if (!msi_map) + return -ENOMEM; + + if (of_property_read_u32_array(dev->of_node, "msi-map", (u32 *)msi_map, + msi_size / sizeof(u32))) + return -EINVAL; + + of_property_read_u32(dev->of_node, "msi-map-mask", &msi_map_mask); + } + + cur = msi_map; + size = msi_size; + mask = msi_map_mask; + + of_get_property(dev->of_node, "iommu-map", &smmu_size); + if (smmu_size) { + smmu_map = devm_kzalloc(dev, smmu_size, GFP_KERNEL); + if (!smmu_map) + return -ENOMEM; + + if (of_property_read_u32_array(dev->of_node, "iommu-map", (u32 *)smmu_map, + smmu_size / sizeof(u32))) + return -EINVAL; + + of_property_read_u32(dev->of_node, "smmu_map_mask", &smmu_map_mask); + } + + if (imx_check_msi_and_smmmu(imx_pcie, msi_map, msi_size, msi_map_mask, + smmu_map, smmu_size, smmu_map_mask)) + return -EINVAL; + + if (!cur) { + cur = smmu_map; + size = smmu_size; + mask = smmu_map_mask; + } + + nr_map = size / (sizeof(*cur)); + + lut_index = 0; + for (i = 0; i < nr_map; i++) { + for (j = 0; j < cur->sid_len; j++) { + imx_pcie_update_lut(imx_pcie, lut_index, cur->bdf + j, mask, + (cur->sid + j) & IMX95_SID_MASK); + lut_index++; + } + cur++; + + if (lut_index >= IMX95_MAX_LUT) { + dev_err(dev, "its-map/iommu-map exceed HW limiation\n"); + return -EINVAL; + } + } + + devm_kfree(dev, smmu_map); + devm_kfree(dev, msi_map); + + return 0; +} + static void imx_pcie_configure_type(struct imx_pcie *imx_pcie) { const struct imx_pcie_drvdata *drvdata = imx_pcie->drvdata; @@ -950,6 +1119,12 @@ static int imx_pcie_host_init(struct dw_pcie_rp *pp) goto err_phy_off; } + ret = imx_pcie_config_sid(imx_pcie); + if (ret < 0) { + dev_err(dev, "failed to config sid:%d\n", ret); + goto err_phy_off; + } + imx_setup_phy_mpll(imx_pcie); return 0;