From patchwork Tue Jul 9 20:23:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13728468 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2070.outbound.protection.outlook.com [40.107.22.70]) (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 9F6F218562C for ; Tue, 9 Jul 2024 20:23:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.70 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720556637; cv=fail; b=D6Z5MfXteO5LehxKDyLReEhxpBae2+m6QgSAvZApcO074yFv+JAnVVVSwMO5O1X4VpOSTnUOFMqjsJas3gBa5pOLwYUVC1lr8tZQx56QqtRoY2IwPDQJiFzt0a2Hxt24R04Q1wUMu77fvmI7vCuFcMZLEcNxsbmO7uScyib+DWg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720556637; c=relaxed/simple; bh=f6OXDb6eLZXmBH224OLnsfJkq1Rey5aQ1bBhSuWJ1I0=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=DbEcyTPi9qbiugTZWKBf0XS4hcNFcwsQQ1hMTuMJW7xhEfKu5u8allRPtdHjdO4A7EwaSEmloUSrfRQmgpFyjoWt2T2fskt59w/eVQWgxp8222uAaG+Gk5U2ZlVa1Fg3BnVw05E8ohHPX2+t0vDS66DDKf0+FWn+l6DKB96oZk4= 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=EBcm16ac; arc=fail smtp.client-ip=40.107.22.70 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="EBcm16ac" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cGlgL9MiPPt95cwOQvk+r35JyW3+4+vVGBeZFn5G8UWiJhuCtkGGghbcOLe1phQo5Ve43hbmCVQsKSsCdrk93leFYA1KG3UOhz8v2L/CMQnVEteKqV7epc48IBzRBU+cTJ9ILurUc1tqKVEsMghqYaggbHXsCcNtJZ9dYMLpcQ8WTd5rZFwPs272V8PcdeEkl9DJf8k2YmXj3HE6GKGIM8XlitIDycNLgvXm+rl8OMUM5yeHbnUSh3s9y7FMYC6YNph9yXhyHGUfCCenrHK1tnFaHawM4ec2VDwu7abAtV2ULRiXklx0CdeeUwo8REdSsvlWwKhAxqk/3fbeNTIWIw== 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=+llaZGd3ThH3xZSiE12Yp5AZPrupVBjPLiolbmqn1fQ=; b=kds9oSw+zuuodEBQZBRP/sQwN36059gXLKQQVmX0Fva5yvOdjBh5nTcF1dWPJBIq/1OKaIZv25l785TXgoRIMAVAl0+kXwei1fGvjI+tppZUUhOF+3BqChDL5KYKtN7jdIIcUWncJUdfmi0jXbUJqbY7fvovOTIqw+9Os4pwjTFLmfisq/i6MG6DPPN/gVVXqx4YvoWY4+fRvBDCMpvX+jh6LfuJiJCtickXk2XPieZUkpch1ZixE6qu16qt5od6AMLc82t/DYzQZ+xmhJbqw3SUut0BwWBwArHaUHCOdxw23LX/Y9HP+YtN4jYJ7g5dst8WRhFwB4sz4E/9MXdjiQ== 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=+llaZGd3ThH3xZSiE12Yp5AZPrupVBjPLiolbmqn1fQ=; b=EBcm16acfCydMBRxh/00Scer1tPv33liamNlzQZg0ScOkUFMdsnDCCzLy67jSORJMDdx6/gXaBd6BHiWk+cvRj9di7p86lBOB2QqApQzeIGk40j+9ohMIrGaGIk8uyM/kDURMkjJufs27qddX5b27mLq/EJL+4gJBHOAkovbEBE= 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 DB9PR04MB8267.eurprd04.prod.outlook.com (2603:10a6:10:24b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35; Tue, 9 Jul 2024 20:23:52 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%2]) with mapi id 15.20.7741.033; Tue, 9 Jul 2024 20:23:52 +0000 From: Frank Li Date: Tue, 09 Jul 2024 16:23:06 -0400 Subject: [PATCH 5/6] EDAC: fsl_ddr: Add support for i.MX9 DDR controller Message-Id: <20240709-imx95_edac-v1-5-3e9c146c1b01@nxp.com> References: <20240709-imx95_edac-v1-0-3e9c146c1b01@nxp.com> In-Reply-To: <20240709-imx95_edac-v1-0-3e9c146c1b01@nxp.com> To: York Sun , Borislav Petkov , Tony Luck , James Morse , Mauro Carvalho Chehab , Robert Richter , Krzysztof Kozlowski , Rob Herring , Conor Dooley , Krzysztof Kozlowski , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam Cc: linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org, Borislav Petkov , devicetree@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, Frank Li , Ye Li , Peng Fan X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1720556601; l=5882; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=CpSB72KuM9NooGj6fUi66TJ5cUJ4AKdkHQLj07U+ubU=; b=L0yyp80JaWeD0GEbKGknTPd4CW06DeRi37o5TJXaY2KIWlxwHNbkGFGntW35phVgM7t7X+yn6 sKnBbBqTuwRDqYTXkl/qPuJQddcEKzTlee7X0wB3DrZkRq8JIG7/4xR X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR03CA0033.namprd03.prod.outlook.com (2603:10b6:a02:a8::46) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|DB9PR04MB8267:EE_ X-MS-Office365-Filtering-Correlation-Id: eaa65157-5fb5-4466-8a5c-08dca0550cc2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|1800799024|7416014|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?S7RFreaDIkIZuS925SMjvpdn4L+iV5E?= =?utf-8?q?sdbd+gaeC+zGXmOD8Prt7OpScAzsJWozC/aUTTXoj35nIDQ+auFSOmRhuDgRyKH+M?= =?utf-8?q?tI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ihlkid8ymboDZgw+gTyZAU9Zr1kUvak1P1LYezTwzqZvkJ31ErLedXE5oZkx+?= =?utf-8?q?gVfVi8V6QKmGbzQUubZHbqtw6slhz+KgfnSvdNIqKRdeIlXmdvMQ0STVHJHLUp0tA?= =?utf-8?q?XuR1fjw+AWlY3RxhYjUzOvlPOI0R0gWa/Mu8HooZYkEcrnPqEweN8PEngY7R6vRy2?= =?utf-8?q?xRol4NGLXwEpF0h+5F34EKsTkUSdUsPQKXm/twgdE86g2SmRCpumi25zeYTeHvLck?= =?utf-8?q?zsDRR5cFC7VAVFzHThTEsixO6KLE4jGOWZJmKTJZFFUoKgOYPM984+Yz5mN3ilDp4?= =?utf-8?q?Lc1HVDTR6TNtRzMnMLZo8hemwfPGjUg+nwYrnTKXCqrfCYXVK08S/Cb2/uQh3ijN0?= =?utf-8?q?b6+6MFTsEBUovKCrIKdvhYRJaMU360M3oa1cCdYaxowu1h/S3SV69dI=3D?= 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:(13230040)(52116014)(376014)(1800799024)(7416014)(366016)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?Fm6Mc+Xcw2S85SRuc/FlgRGZNLcX?= =?utf-8?q?nt0EDo/JjZ+KqcaCMGkWuRzS3XwE7Snq5+vTIuA7UTU4O+gXaD05Chw0vvp/nmh1e?= =?utf-8?q?QTFdOqzqduWMXb3IwiG0uJRZ23cu2mj7Ad/EAcXSdHUECxJKrQk4C1GFOKQnEYTJT?= =?utf-8?q?stNo81c9rvx7drqG29arvK4LMo1RN4HFWuq+UUHrSW8D+Jy1Cw5PEshrrTkdiivXd?= =?utf-8?q?al9anZ6W23UxlhJtgAm8TMwOT4IGXS4FnX+CMezolYo4N3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+IXeOsfvEBzpEjma?= =?utf-8?q?CGnhiKmoxvNZs85FqGrqmNKI9c//GDJxP8hjYVY3I+dNwaTjKrY1+Ny+IWmrfB0lO?= =?utf-8?q?/dm/wPu8grVuW+Gy3URCC3ydWadOeRSNJerE4cm7PqsNDxxbMPckQHbEHCAB8zZjm?= =?utf-8?q?F5rcxI1aM7uYp3MHmt60d3BDyI4/jqHnzifCQlK1pk1I3AWMhbINPN+xFAgVwBDxD?= =?utf-8?q?SDelKshx35UQGQa2JVdyIzu8gPWhUoalRiKwEVmrctNNTVhIc80ddcF48vvVYijhT?= =?utf-8?q?5uYc0z5sg999yXMmfGu33/LfDn9Jgby1Bm1kyykdta3mKqR885vJgXhZtN9b399q7?= =?utf-8?q?ubAA5T4w30+FWYLzIP4Dio4TS0cS2kJyX74wMxMLbW/D2DWvzP8WyGHdcbIs6P5Dj?= =?utf-8?q?bgKXh3tHXFYH?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: eaa65157-5fb5-4466-8a5c-08dca0550cc2 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jul 2024 20:23:52.7567 (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: TUZ37exuyuQbl9uFcGG/cvbjh7VEIw0iyg1QGMlmELG5HIlcQ/gBnLjIwGOeTBX3KWoOu1XUgAs7oUdrdM0D3A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8267 From: Ye Li i.MX9 uses an DDR controller that has registers offset and some function changed, but the ECC and Error inject functions are almost same with fsl_ddr controller. So update and re-use the driver for i.MX9. A special type is added for i.MX9 controller only to distinguish the difference. Signed-off-by: Ye Li Reviewed-by: Peng Fan Signed-off-by: Frank Li --- drivers/edac/fsl_ddr_edac.c | 48 ++++++++++++++++++++++++++++++++++++------ drivers/edac/fsl_ddr_edac.h | 10 +++++++++ drivers/edac/layerscape_edac.c | 1 + 3 files changed, 53 insertions(+), 6 deletions(-) diff --git a/drivers/edac/fsl_ddr_edac.c b/drivers/edac/fsl_ddr_edac.c index da743cf8a95e9..438b995066f2a 100644 --- a/drivers/edac/fsl_ddr_edac.c +++ b/drivers/edac/fsl_ddr_edac.c @@ -31,16 +31,28 @@ static int edac_mc_idx; +static inline void __iomem *ddr_reg_addr(struct fsl_mc_pdata *pdata, unsigned int off) +{ + if (pdata->flag == TYPE_IMX9 && off >= FSL_MC_DATA_ERR_INJECT_HI && off <= FSL_MC_ERR_SBE) + return pdata->inject_vbase + off - FSL_MC_DATA_ERR_INJECT_HI + + IMX9_MC_DATA_ERR_INJECT_OFF; + + if (pdata->flag == TYPE_IMX9 && off >= IMX9_MC_ERR_EN) + return pdata->inject_vbase + off - IMX9_MC_ERR_EN; + + return pdata->mc_vbase + off; +} + static inline u32 ddr_in32(struct fsl_mc_pdata *pdata, unsigned int off) { - void __iomem *addr = pdata->mc_vbase + off; + void __iomem *addr = ddr_reg_addr(pdata, off); return pdata->little_endian ? ioread32(addr) : ioread32be(addr); } static inline void ddr_out32(struct fsl_mc_pdata *pdata, unsigned int off, u32 value) { - void __iomem *addr = pdata->mc_vbase + off; + void __iomem *addr = ddr_reg_addr(pdata, off); if (pdata->little_endian) iowrite32(value, addr); @@ -438,6 +450,9 @@ static void fsl_ddr_init_csrows(struct mem_ctl_info *mci) case 0x05000000: mtype = MEM_DDR4; break; + case 0x04000000: + mtype = MEM_LPDDR4; + break; default: mtype = MEM_UNKNOWN; break; @@ -471,7 +486,9 @@ static void fsl_ddr_init_csrows(struct mem_ctl_info *mci) dimm->grain = 8; dimm->mtype = mtype; dimm->dtype = DEV_UNKNOWN; - if (sdram_ctl & DSC_X32_EN) + if (pdata->flag == TYPE_IMX9) + dimm->dtype = DEV_X16; + else if (sdram_ctl & DSC_X32_EN) dimm->dtype = DEV_X32; dimm->edac_mode = EDAC_SECDED; } @@ -483,6 +500,7 @@ int fsl_mc_err_probe(struct platform_device *op) struct edac_mc_layer layers[2]; struct fsl_mc_pdata *pdata; struct resource r; + u32 ecc_en_mask; u32 sdram_ctl; int res; @@ -510,6 +528,8 @@ int fsl_mc_err_probe(struct platform_device *op) mci->ctl_name = pdata->name; mci->dev_name = pdata->name; + pdata->flag = (unsigned long)device_get_match_data(&op->dev); + /* * Get the endianness of DDR controller registers. * Default is big endian. @@ -538,8 +558,23 @@ int fsl_mc_err_probe(struct platform_device *op) goto err; } - sdram_ctl = ddr_in32(pdata, FSL_MC_DDR_SDRAM_CFG); - if (!(sdram_ctl & DSC_ECC_EN)) { + if (pdata->flag == TYPE_IMX9) { + pdata->inject_vbase = devm_platform_ioremap_resource_byname(op, "inject"); + if (IS_ERR(pdata->inject_vbase)) { + res = -ENOMEM; + goto err; + } + } + + if (pdata->flag == TYPE_IMX9) { + sdram_ctl = ddr_in32(pdata, IMX9_MC_ERR_EN); + ecc_en_mask = ERR_ECC_EN | ERR_INLINE_ECC; + } else { + sdram_ctl = ddr_in32(pdata, FSL_MC_DDR_SDRAM_CFG); + ecc_en_mask = DSC_ECC_EN; + } + + if ((sdram_ctl & ecc_en_mask) != ecc_en_mask) { /* no ECC */ pr_warn("%s: No ECC DIMMs discovered\n", __func__); res = -ENODEV; @@ -550,7 +585,8 @@ int fsl_mc_err_probe(struct platform_device *op) mci->mtype_cap = MEM_FLAG_DDR | MEM_FLAG_RDDR | MEM_FLAG_DDR2 | MEM_FLAG_RDDR2 | MEM_FLAG_DDR3 | MEM_FLAG_RDDR3 | - MEM_FLAG_DDR4 | MEM_FLAG_RDDR4; + MEM_FLAG_DDR4 | MEM_FLAG_RDDR4 | + MEM_FLAG_LPDDR4; mci->edac_ctl_cap = EDAC_FLAG_NONE | EDAC_FLAG_SECDED; mci->edac_cap = EDAC_FLAG_SECDED; mci->mod_name = EDAC_MOD_STR; diff --git a/drivers/edac/fsl_ddr_edac.h b/drivers/edac/fsl_ddr_edac.h index de66f9822fba1..73618f79e587f 100644 --- a/drivers/edac/fsl_ddr_edac.h +++ b/drivers/edac/fsl_ddr_edac.h @@ -39,6 +39,9 @@ #define FSL_MC_CAPTURE_EXT_ADDRESS 0x0e54 #define FSL_MC_ERR_SBE 0x0e58 +#define IMX9_MC_ERR_EN 0x1000 +#define IMX9_MC_DATA_ERR_INJECT_OFF 0x100 + #define DSC_MEM_EN 0x80000000 #define DSC_ECC_EN 0x20000000 #define DSC_RD_EN 0x10000000 @@ -46,6 +49,9 @@ #define DSC_DBW_32 0x00080000 #define DSC_DBW_64 0x00000000 +#define ERR_ECC_EN 0x80000000 +#define ERR_INLINE_ECC 0x40000000 + #define DSC_SDTYPE_MASK 0x07000000 #define DSC_X32_EN 0x00000020 @@ -65,14 +71,18 @@ #define DDR_EDI_SBED 0x4 /* single-bit ECC error disable */ #define DDR_EDI_MBED 0x8 /* multi-bit ECC error disable */ +#define TYPE_IMX9 0x1 /* MC used by iMX9 having registers changed */ + struct fsl_mc_pdata { char *name; int edac_idx; void __iomem *mc_vbase; + void __iomem *inject_vbase; int irq; u32 orig_ddr_err_disable; u32 orig_ddr_err_sbe; bool little_endian; + unsigned long flag; }; int fsl_mc_err_probe(struct platform_device *op); void fsl_mc_err_remove(struct platform_device *op); diff --git a/drivers/edac/layerscape_edac.c b/drivers/edac/layerscape_edac.c index 0d42c1238908b..9a0c92ebbc3c4 100644 --- a/drivers/edac/layerscape_edac.c +++ b/drivers/edac/layerscape_edac.c @@ -21,6 +21,7 @@ static const struct of_device_id fsl_ddr_mc_err_of_match[] = { { .compatible = "fsl,qoriq-memory-controller", }, + { .compatible = "nxp,imx9-memory-controller", .data = (void *)TYPE_IMX9, }, {}, }; MODULE_DEVICE_TABLE(of, fsl_ddr_mc_err_of_match);