From patchwork Thu Jun 4 14:28:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tthayer@opensource.altera.com X-Patchwork-Id: 6547601 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 28FE3C0433 for ; Thu, 4 Jun 2015 14:31:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A65C4207EA for ; Thu, 4 Jun 2015 14:31:06 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 931FE205FC for ; Thu, 4 Jun 2015 14:31:02 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z0W84-0002ap-7I; Thu, 04 Jun 2015 14:28:20 +0000 Received: from mail-bn1on0095.outbound.protection.outlook.com ([157.56.110.95] helo=na01-bn1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z0W7l-0002Sc-St for linux-arm-kernel@lists.infradead.org; Thu, 04 Jun 2015 14:28:04 +0000 Received: from BLUPR0301CA0024.namprd03.prod.outlook.com (10.162.113.162) by BN1PR03MB236.namprd03.prod.outlook.com (10.255.200.28) with Microsoft SMTP Server (TLS) id 15.1.190.9; Thu, 4 Jun 2015 14:27:37 +0000 Received: from BY2FFO11FD018.protection.gbl (2a01:111:f400:7c0c::132) by BLUPR0301CA0024.outlook.office365.com (2a01:111:e400:5259::34) with Microsoft SMTP Server (TLS) id 15.1.184.17 via Frontend Transport; Thu, 4 Jun 2015 14:27:37 +0000 Authentication-Results: spf=fail (sender IP is 66.35.236.236) smtp.mailfrom=opensource.altera.com; alien8.de; dkim=none (message not signed) header.d=none; Received-SPF: Fail (protection.outlook.com: domain of opensource.altera.com does not designate 66.35.236.236 as permitted sender) receiver=protection.outlook.com; client-ip=66.35.236.236; helo=sj-itexedge04.altera.priv.altera.com; Received: from sj-itexedge04.altera.priv.altera.com (66.35.236.236) by BY2FFO11FD018.mail.protection.outlook.com (10.1.14.106) with Microsoft SMTP Server (TLS) id 15.1.184.11 via Frontend Transport; Thu, 4 Jun 2015 14:27:35 +0000 Received: from na01-by2-obe.outbound.protection.outlook.com (207.46.163.238) by webmail.altera.com (66.35.236.236) with Microsoft SMTP Server (TLS) id 14.3.174.1; Thu, 4 Jun 2015 07:26:23 -0700 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=tthayer@opensource.altera.com; Received: from localhost.localdomain (64.129.157.38) by BLUPR03MB423.namprd03.prod.outlook.com (10.141.78.150) with Microsoft SMTP Server (TLS) id 15.1.184.10; Thu, 4 Jun 2015 14:26:58 +0000 From: To: , , , , , , , , , , Subject: [PATCHv2 2/4] edac, altera: Refactor EDAC for Altera CycloneV SoC. Date: Thu, 4 Jun 2015 09:28:46 -0500 Message-ID: <1433428128-7292-3-git-send-email-tthayer@opensource.altera.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1433428128-7292-1-git-send-email-tthayer@opensource.altera.com> References: <1433428128-7292-1-git-send-email-tthayer@opensource.altera.com> MIME-Version: 1.0 X-Originating-IP: [64.129.157.38] X-ClientProxiedBy: SN1PR12CA0039.namprd12.prod.outlook.com (25.162.96.177) To BLUPR03MB423.namprd03.prod.outlook.com (10.141.78.150) X-Microsoft-Exchange-Diagnostics-untrusted: 1; BLUPR03MB423; 2:YSX3eSaRgKuduKSIOgB6WIrlyDV90cIWs5lSM8VazflVn/8Mv4qyNJ+6ARA5E1Be; 2:8pwyy6ZTK6jKVohlwvX8nFLyvvdpYHRa/vCNhOSCWvdlDtzPpxgE5FS8Ie4BtBHHIS+jQUcPzCc8QAfAoY36onIANhoGfzIcnKTdOAVtvqtVZCJb21B8L7DuO5/rGXK1/FRtehIapJ1obvx5uTbWVQ==; 6:acKGe9NA1JsybgrkOM4+bAm9UoazRuasMqfY7e7ueaC/YwyJgyQ1cLVs3tDFYHUJZjI8M1/126mGIiQHrBVxLNGggLNbw8Gk0eZlwVZwLNFEgjK6u/xGXFV2VGwZB8XFugUHH6KmaSu1gJVH2obFXQ==; 3:F6ohDM7Xj5j+SxUgV0kqtbtIam7yH+1ierpqv9zZJdIrkygcVtx54w3EmHbiVjtwoyAsFN526eaJjxW3zyfvpWlXF3hcqRo3hUN1/j8Ijkw508b6NIVLNi89XQihuL2C+avn+ZGE3rkem2SVg8HHGfY0E1YJXoDBfte5SV71gQafQaQkztFaPPWV3AbZiOmfxWhBErFAHCW0+qKQxpVZbyZfPttNxUvgl7G4KCg53Kl0hP2zvrluzMGOnbN183gaMJBPdeV8tuRhFaTl5hWdGmgiMCFmdI7IvgFrNac+LWTyECBnu2GKX6/u4OS9/iqW X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:; SRVR:BLUPR03MB423; UriScan:; BCL:0; PCL:0; RULEID:; SRVR:BN1PR03MB236; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:;UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(520003)(5005006)(3002001); SRVR:BLUPR03MB423; BCL:0; PCL:0; RULEID:; SRVR:BLUPR03MB423; BCL:0; PCL:0; RULEID:(601004)(520003)(5005006)(3002001); SRVR:BN1PR03MB236; BCL:0; PCL:0; RULEID:; SRVR:BN1PR03MB236; X-Forefront-PRVS: 0597911EE1 X-Forefront-Antispam-Report-Untrusted: SFV:NSPM; SFS:(10009020)(6069001)(6009001)(199003)(189002)(42186005)(101416001)(106356001)(50466002)(5001830100001)(64706001)(76176999)(47776003)(33646002)(81156007)(4001540100001)(92566002)(122386002)(48376002)(97736004)(5001770100001)(77156002)(62966003)(40100003)(19580395003)(68736005)(50226001)(229853001)(46102003)(15975445007)(86152002)(2201001)(2950100001)(66066001)(5001960100002)(189998001)(50986999)(107886002)(19580405001)(5001860100001)(105586002)(86362001)(575784001)(87976001)(77096005)(921003)(2004002)(4001430100001)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR03MB423; H:localhost.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; A:0; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: opensource.altera.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics-untrusted: =?us-ascii?Q?1; BLUPR03MB423; 9:sgBvODOpT1vL5NgvEx7KXzwkkdMblVyTvI5nipnx+iq?= =?us-ascii?Q?7gn5Rs/xWjD074CkdfY4Orv3xjXttS6vMfp988JAngmheCaWdY2lhnpLCX09?= =?us-ascii?Q?CI19T92byNRAYV2GIHtbARIs4GndjYqNw4kZ6mWgIcumgRYOhjeffA5Zimjs?= =?us-ascii?Q?VpYJzVKbRdpehM65qFb7zKeEwM4TMH96VlhwPtEMYuLFYGIe7LazQSW2/n6h?= =?us-ascii?Q?pOaVBXFvNQC1dWpkI1BMTtc2o+gmXdAe0G+0ZJUAfSMX0Ln/G/bb0zi/XclJ?= =?us-ascii?Q?Bj0t8RyzrbaDYM8H+9E6231OP5ApMeaXPG83MGxfFUoRBaCAuU5qsRBG9Y4q?= =?us-ascii?Q?lrLznclpbXhbdee8/P+doGzuVdrDH7FW4XII3hldim6PrHGYe4Ew+h27tHnR?= =?us-ascii?Q?aKFPgAoz8LagRrrTLVpd/pjO8JokKHg2moJt5DfR16v3TZ+82imkNimN2VPK?= =?us-ascii?Q?cOKTVJ3mezSTL+aFX/mDqkzrEngK29wBMF4KRcKMS6jB6FvbJmfprPMK4hRF?= =?us-ascii?Q?06Frqi1r+Ocd/19RU/QuKf5U+p2e8cdiYkk//Lnedv2xSfighAWcBpZo+yN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CeTZWvGl6cEG3LyV34GymXznBJ9UTp38rNkEasa+/xlobaC9LDI1OKME1Bip2PCP4HF+/go1JpcY4=; 6:b21ji3CdoJaug2wd8aEVSoAyX0iSDXI1C3uEn8F26tSONvaA+9N67FcacGBmkzHI19fLmEN5LT7ejPCZYbv+1A4KYLMftk+k5/l7UGTsQbtOzMgHZeFSO+6cnqWDkMRST050TkRXERrhPqq+G8Ok+Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR03MB423 X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: BY2FFO11FD018.protection.gbl X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD018; 1:hThhIhsWD/wHwXJ1oznwpUfh8XHtRnE98ckSyC6gMSb2yybprkMLRQC/rZNWi3EzP1cPO0EPgbXuQmYrCyLKIHOHfKzG99wG7tqBM4xgP2BUflgY4j77TuyhRCuGgqR7DC4u6vtVX15o//ALtXK1+wgwWPxASjJoxfY7oJaLYl4+NormaOdvqngvO8nPid2Z9miq8LqDSwCRseTGMxklDSiM+UaLJnoDO64CpzlP5w0J85zGREssp2Jk7TjhRBmvmNU0WyoqlOfgWXjxns92fA== X-Forefront-Antispam-Report: CIP:66.35.236.236; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(339900001)(199003)(189002)(2201001)(86152002)(16796002)(189998001)(105606002)(5001960100002)(107886002)(97736004)(5001770100001)(6070500001)(4001540100001)(92566002)(81156007)(86362001)(5001860100001)(50466002)(575784001)(5001830100001)(19580405001)(2950100001)(19580395003)(48376002)(122386002)(46102003)(47776003)(64706001)(40100003)(66066001)(50986999)(76176999)(106466001)(77096005)(77156002)(62966003)(15975445007)(68736005)(87936001)(50226001)(49486002)(85426001)(6806004)(33646002)(229853001)(7099028)(921003)(2004002)(1121003)(4001430100001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN1PR03MB236; H:sj-itexedge04.altera.priv.altera.com; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:0; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1PR03MB236; 2:lMY8H4pG4S6hrRFdYSADZcl2M4nKP9e04Udbt8GUKGQsvMc8ZLwcmdEY7VuntD4U; 2:ddsfgW5cEW+Fe3hrncJcQPhIWB6dCCAJar/TUtU0ktN6SKsRvfYVr3Q99t9E6Ov31K+RIOfHxniDcr9f251pTW+kduUXF1JUx8h648jNmVm5Hwu48Etqcm5yVOH7r+u6u/MRVyPCCup2Vy30Gh1iEOBG8I0r+khPuXsJzP1WffWHm0KpWGCqxMX93kxHyk5dp1R5bbcA4VVTBwDTAWgusBfKWB4UNgAv9nbppZ8AZiQ=; 6:2sqaYbbH+Vq+7zSki3TPBOTYwQDIKNk3rBkAekZtDPv3CF4gdxad/JtzBEHcHyFKBuZOszSz1nDaGmR2tm0xcZDxWRZC5x7cai0ZwMGUnw3jJ1djHFsVC9Pu5FESnjPPeHPHFsFViOJMfAliJLurnQ==; 3:ba328gIefUcq9WoJ/28Zi3kD6rKWB88lwj9D8vUKYdpIZIhdcIBWjOKp/CKkpsBbb9wP1/sDmjlytEn/1hmiK+RkN184Yv8OXzxwyYRBzcnx6Xivilrc1Dx6xtOK0gBmKyCm6132jgAYGpURvdNZ1g/fBX8PU8662grBdiIHDozN//4Ne34WiqpckwKB3mYvdJNs6nYrd1lIFa51puk0j1O32L6qcpLJRdqLxKhOxbCV9/aFXcC8JrhlJNOTODrKIB+wo6KwKBis3LRl+3L5qpwK4fFg+qQnaS6nctj1MX37MB4P/Odbs+kpRa04gU1f X-Forefront-PRVS: 0597911EE1 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN1PR03MB236; 9:BG1lK708lYpyrXhD0HhgMWp1tLyq2m2DkZgp0rmhxXk?= =?us-ascii?Q?y63EUDQJFkQJYmSNmEfQ5sXGWs2taAJLfOezL2tBDrSRgf/YYuJLQymvhf9f?= =?us-ascii?Q?JMUHq+HSs+SUJO1KVDMbhgz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=?us-ascii?Q?VA5KMZHfNcVgODwNM7bqmaKqVAjwpIDsdIrfvEm+ZsZ7TJgHtKWOS6zhUkv1?= =?us-ascii?Q?rKjYzYL62glW2zW3seUkAULLmPxpZAcNdB6jZ+Sta4/QWa/VQB4yPPfS4H0q?= =?us-ascii?Q?t97gXAo3M4bYrEBPXaL0t9jXtBt6c5xXBENQQwQPddErHWz+ly/lwvRS6EwM?= =?us-ascii?Q?tnaKbaZ4JqyC/yURx4sZxK54y/orTlyDYcn3/iDw60WrXBLQfJ+AidQaZ74R?= =?us-ascii?Q?Mu3XQxt1LAxviyTmp3PORB+fWR9gUqWgdF9U90GqE48LS8VNCftaMwVBr8Vh?= =?us-ascii?Q?TZ+EZtvXA9SrLDqfTZqEbZDJRVdl17zROBIm9asAX?= X-Microsoft-Exchange-Diagnostics: 1; BN1PR03MB236; 3:2ea3mgLFkjNw9eXUSmMqEWnW6rZFVpqZ1LUuvySJ9u/xQLjbNppaz11Y42BQrJMwgPTIAy59blB3H7an1nd4o9Zgi6lIyUAUAjSTEDW6HzSKV3q9LOWdl6LdXPSkQbXBHN1KhXnRYTC9BUFD7RrSBg==; 10:5MM1GW5IdtiZNqneDU2Lig4X14mXwifWs4jSGpkXp07gFKhXHT6vztuNVtk5etMBMQ/XjDoObNi1UnKnm1TU7faGBII9ZgsanGx+gsl7Lps=; 6:Qpyke18zFu+kxWL6x+iyPvioTDa8Jr64Z7UxEb+sbZR5fU92MGT5YksOpT7OJ0xk98wYFtYR/JmbURFTxCnVehAZJi7zf1JqLM136X6okKKIFgS6GUvAP1sldI94jW6sj03JP8SjALNbqkINlbGzWQ== X-OriginatorOrg: opensource.altera.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jun 2015 14:27:35.9318 (UTC) X-MS-Exchange-CrossTenant-Id: fbd72e03-d4a5-4110-adce-614d51f2077a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=fbd72e03-d4a5-4110-adce-614d51f2077a; Ip=[66.35.236.236]; Helo=[sj-itexedge04.altera.priv.altera.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN1PR03MB236 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150604_072802_293675_D6301EB9 X-CRM114-Status: UNSURE ( 9.47 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.1 (-) Cc: devicetree@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, tthayer.linux@gmail.com, tthayer@opensource.altera.com, linux-arm-kernel@lists.infradead.org, linux-edac@vger.kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Thor Thayer The Arria10 SOC uses a completely different SDRAM controller from the earlier CycloneV and ArriaV SoCs. This patch abstracts the SDRAM bits for the CycloneV/ArriaV SoCs in preparation for the Arria10 support. Signed-off-by: Thor Thayer Acked-by: Borislav Petkov --- v2: Make c5_data static. --- drivers/edac/altera_edac.c | 194 ++++++++++++++++++++------------------------ drivers/edac/altera_edac.h | 116 ++++++++++++++++++++++++++ 2 files changed, 206 insertions(+), 104 deletions(-) create mode 100644 drivers/edac/altera_edac.h diff --git a/drivers/edac/altera_edac.c b/drivers/edac/altera_edac.c index a9e7c69..a8350f6 100644 --- a/drivers/edac/altera_edac.c +++ b/drivers/edac/altera_edac.c @@ -1,5 +1,5 @@ /* - * Copyright Altera Corporation (C) 2014. All rights reserved. + * Copyright Altera Corporation (C) 2014-2015. All rights reserved. * Copyright 2011-2012 Calxeda, Inc. * * This program is free software; you can redistribute it and/or modify it @@ -28,111 +28,64 @@ #include #include +#include "altera_edac.h" #include "edac_core.h" #include "edac_module.h" #define EDAC_MOD_STR "altera_edac" #define EDAC_VERSION "1" -/* SDRAM Controller CtrlCfg Register */ -#define CTLCFG_OFST 0x00 - -/* SDRAM Controller CtrlCfg Register Bit Masks */ -#define CTLCFG_ECC_EN 0x400 -#define CTLCFG_ECC_CORR_EN 0x800 -#define CTLCFG_GEN_SB_ERR 0x2000 -#define CTLCFG_GEN_DB_ERR 0x4000 - -#define CTLCFG_ECC_AUTO_EN (CTLCFG_ECC_EN | \ - CTLCFG_ECC_CORR_EN) - -/* SDRAM Controller Address Width Register */ -#define DRAMADDRW_OFST 0x2C - -/* SDRAM Controller Address Widths Field Register */ -#define DRAMADDRW_COLBIT_MASK 0x001F -#define DRAMADDRW_COLBIT_SHIFT 0 -#define DRAMADDRW_ROWBIT_MASK 0x03E0 -#define DRAMADDRW_ROWBIT_SHIFT 5 -#define DRAMADDRW_BANKBIT_MASK 0x1C00 -#define DRAMADDRW_BANKBIT_SHIFT 10 -#define DRAMADDRW_CSBIT_MASK 0xE000 -#define DRAMADDRW_CSBIT_SHIFT 13 - -/* SDRAM Controller Interface Data Width Register */ -#define DRAMIFWIDTH_OFST 0x30 - -/* SDRAM Controller Interface Data Width Defines */ -#define DRAMIFWIDTH_16B_ECC 24 -#define DRAMIFWIDTH_32B_ECC 40 - -/* SDRAM Controller DRAM Status Register */ -#define DRAMSTS_OFST 0x38 - -/* SDRAM Controller DRAM Status Register Bit Masks */ -#define DRAMSTS_SBEERR 0x04 -#define DRAMSTS_DBEERR 0x08 -#define DRAMSTS_CORR_DROP 0x10 - -/* SDRAM Controller DRAM IRQ Register */ -#define DRAMINTR_OFST 0x3C - -/* SDRAM Controller DRAM IRQ Register Bit Masks */ -#define DRAMINTR_INTREN 0x01 -#define DRAMINTR_SBEMASK 0x02 -#define DRAMINTR_DBEMASK 0x04 -#define DRAMINTR_CORRDROPMASK 0x08 -#define DRAMINTR_INTRCLR 0x10 - -/* SDRAM Controller Single Bit Error Count Register */ -#define SBECOUNT_OFST 0x40 - -/* SDRAM Controller Single Bit Error Count Register Bit Masks */ -#define SBECOUNT_MASK 0x0F - -/* SDRAM Controller Double Bit Error Count Register */ -#define DBECOUNT_OFST 0x44 - -/* SDRAM Controller Double Bit Error Count Register Bit Masks */ -#define DBECOUNT_MASK 0x0F - -/* SDRAM Controller ECC Error Address Register */ -#define ERRADDR_OFST 0x48 - -/* SDRAM Controller ECC Error Address Register Bit Masks */ -#define ERRADDR_MASK 0xFFFFFFFF - -/* Altera SDRAM Memory Controller data */ -struct altr_sdram_mc_data { - struct regmap *mc_vbase; +static const struct altr_sdram_prv_data c5_data = { + .ecc_ctrl_offset = CV_CTLCFG_OFST, + .ecc_ctl_en_mask = CV_CTLCFG_ECC_AUTO_EN, + .ecc_stat_offset = CV_DRAMSTS_OFST, + .ecc_stat_ce_mask = CV_DRAMSTS_SBEERR, + .ecc_stat_ue_mask = CV_DRAMSTS_DBEERR, + .ecc_saddr_offset = CV_ERRADDR_OFST, + .ecc_cecnt_offset = CV_SBECOUNT_OFST, + .ecc_uecnt_offset = CV_DBECOUNT_OFST, + .ecc_irq_en_offset = CV_DRAMINTR_OFST, + .ecc_irq_en_mask = CV_DRAMINTR_INTREN, + .ecc_irq_clr_offset = CV_DRAMINTR_OFST, + .ecc_irq_clr_mask = (CV_DRAMINTR_INTRCLR | CV_DRAMINTR_INTREN), + .ecc_cnt_rst_offset = CV_DRAMINTR_OFST, + .ecc_cnt_rst_mask = CV_DRAMINTR_INTRCLR, +#ifdef CONFIG_EDAC_DEBUG + .ce_ue_trgr_offset = CV_CTLCFG_OFST, + .ce_set_mask = CV_CTLCFG_GEN_SB_ERR, + .ue_set_mask = CV_CTLCFG_GEN_DB_ERR, +#endif }; static irqreturn_t altr_sdram_mc_err_handler(int irq, void *dev_id) { struct mem_ctl_info *mci = dev_id; struct altr_sdram_mc_data *drvdata = mci->pvt_info; + const struct altr_sdram_prv_data *priv = drvdata->data; u32 status, err_count, err_addr; /* Error Address is shared by both SBE & DBE */ - regmap_read(drvdata->mc_vbase, ERRADDR_OFST, &err_addr); + regmap_read(drvdata->mc_vbase, priv->ecc_saddr_offset, &err_addr); - regmap_read(drvdata->mc_vbase, DRAMSTS_OFST, &status); + regmap_read(drvdata->mc_vbase, priv->ecc_stat_offset, &status); - if (status & DRAMSTS_DBEERR) { - regmap_read(drvdata->mc_vbase, DBECOUNT_OFST, &err_count); + if (status & priv->ecc_stat_ue_mask) { + regmap_read(drvdata->mc_vbase, priv->ecc_uecnt_offset, + &err_count); panic("\nEDAC: [%d Uncorrectable errors @ 0x%08X]\n", err_count, err_addr); } - if (status & DRAMSTS_SBEERR) { - regmap_read(drvdata->mc_vbase, SBECOUNT_OFST, &err_count); + if (status & priv->ecc_stat_ce_mask) { + regmap_read(drvdata->mc_vbase, priv->ecc_cecnt_offset, + &err_count); edac_mc_handle_error(HW_EVENT_ERR_CORRECTED, mci, err_count, err_addr >> PAGE_SHIFT, err_addr & ~PAGE_MASK, 0, 0, 0, -1, mci->ctl_name, ""); } - regmap_write(drvdata->mc_vbase, DRAMINTR_OFST, - (DRAMINTR_INTRCLR | DRAMINTR_INTREN)); + regmap_write(drvdata->mc_vbase, priv->ecc_irq_clr_offset, + priv->ecc_irq_clr_mask); return IRQ_HANDLED; } @@ -144,6 +97,7 @@ static ssize_t altr_sdr_mc_err_inject_write(struct file *file, { struct mem_ctl_info *mci = file->private_data; struct altr_sdram_mc_data *drvdata = mci->pvt_info; + const struct altr_sdram_prv_data *priv = drvdata->data; u32 *ptemp; dma_addr_t dma_handle; u32 reg, read_reg; @@ -156,8 +110,9 @@ static ssize_t altr_sdr_mc_err_inject_write(struct file *file, return -ENOMEM; } - regmap_read(drvdata->mc_vbase, CTLCFG_OFST, &read_reg); - read_reg &= ~(CTLCFG_GEN_SB_ERR | CTLCFG_GEN_DB_ERR); + regmap_read(drvdata->mc_vbase, priv->ce_ue_trgr_offset, + &read_reg); + read_reg &= ~(priv->ce_set_mask | priv->ue_set_mask); /* Error are injected by writing a word while the SBE or DBE * bit in the CTLCFG register is set. Reading the word will @@ -166,20 +121,20 @@ static ssize_t altr_sdr_mc_err_inject_write(struct file *file, if (count == 3) { edac_printk(KERN_ALERT, EDAC_MC, "Inject Double bit error\n"); - regmap_write(drvdata->mc_vbase, CTLCFG_OFST, - (read_reg | CTLCFG_GEN_DB_ERR)); + regmap_write(drvdata->mc_vbase, priv->ce_ue_trgr_offset, + (read_reg | priv->ue_set_mask)); } else { edac_printk(KERN_ALERT, EDAC_MC, "Inject Single bit error\n"); - regmap_write(drvdata->mc_vbase, CTLCFG_OFST, - (read_reg | CTLCFG_GEN_SB_ERR)); + regmap_write(drvdata->mc_vbase, priv->ce_ue_trgr_offset, + (read_reg | priv->ce_set_mask)); } ptemp[0] = 0x5A5A5A5A; ptemp[1] = 0xA5A5A5A5; /* Clear the error injection bits */ - regmap_write(drvdata->mc_vbase, CTLCFG_OFST, read_reg); + regmap_write(drvdata->mc_vbase, priv->ce_ue_trgr_offset, read_reg); /* Ensure it has been written out */ wmb(); @@ -246,18 +201,29 @@ static unsigned long get_total_mem(void) return total_mem; } +static const struct of_device_id altr_sdram_ctrl_of_match[] = { + { .compatible = "altr,sdram-edac", .data = (void *)&c5_data}, + {}, +}; +MODULE_DEVICE_TABLE(of, altr_sdram_ctrl_of_match); + static int altr_sdram_probe(struct platform_device *pdev) { + const struct of_device_id *id; struct edac_mc_layer layers[2]; struct mem_ctl_info *mci; struct altr_sdram_mc_data *drvdata; + const struct altr_sdram_prv_data *priv; struct regmap *mc_vbase; struct dimm_info *dimm; - u32 read_reg, mem_size; - int irq; - int res = 0; + u32 read_reg; + int irq, res = 0; + unsigned long mem_size; + + id = of_match_device(altr_sdram_ctrl_of_match, &pdev->dev); + if (!id) + return -ENODEV; - /* Validate the SDRAM controller has ECC enabled */ /* Grab the register range from the sdr controller in device tree */ mc_vbase = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, "altr,sdr-syscon"); @@ -267,8 +233,13 @@ static int altr_sdram_probe(struct platform_device *pdev) return -ENODEV; } - if (regmap_read(mc_vbase, CTLCFG_OFST, &read_reg) || - ((read_reg & CTLCFG_ECC_AUTO_EN) != CTLCFG_ECC_AUTO_EN)) { + /* Check specific dependencies for the module */ + priv = of_match_node(altr_sdram_ctrl_of_match, + pdev->dev.of_node)->data; + + /* Validate the SDRAM controller has ECC enabled */ + if (regmap_read(mc_vbase, priv->ecc_ctrl_offset, &read_reg) || + ((read_reg & priv->ecc_ctl_en_mask) != priv->ecc_ctl_en_mask)) { edac_printk(KERN_ERR, EDAC_MC, "No ECC/ECC disabled [0x%08X]\n", read_reg); return -ENODEV; @@ -282,10 +253,27 @@ static int altr_sdram_probe(struct platform_device *pdev) return -ENODEV; } - /* Ensure the SDRAM Interrupt is disabled and cleared */ - if (regmap_write(mc_vbase, DRAMINTR_OFST, DRAMINTR_INTRCLR)) { + /* Ensure the SDRAM Interrupt is disabled */ + if (regmap_update_bits(mc_vbase, priv->ecc_irq_en_offset, + priv->ecc_irq_en_mask, 0)) { + edac_printk(KERN_ERR, EDAC_MC, + "Error disabling SDRAM ECC IRQ\n"); + return -ENODEV; + } + + /* Toggle to clear the SDRAM Error count */ + if (regmap_update_bits(mc_vbase, priv->ecc_cnt_rst_offset, + priv->ecc_cnt_rst_mask, + priv->ecc_cnt_rst_mask)) { + edac_printk(KERN_ERR, EDAC_MC, + "Error clearing SDRAM ECC count\n"); + return -ENODEV; + } + + if (regmap_update_bits(mc_vbase, priv->ecc_cnt_rst_offset, + priv->ecc_cnt_rst_mask, 0)) { edac_printk(KERN_ERR, EDAC_MC, - "Error clearing SDRAM ECC IRQ\n"); + "Error clearing SDRAM ECC count\n"); return -ENODEV; } @@ -310,9 +298,12 @@ static int altr_sdram_probe(struct platform_device *pdev) mci->pdev = &pdev->dev; drvdata = mci->pvt_info; drvdata->mc_vbase = mc_vbase; + drvdata->data = priv; platform_set_drvdata(pdev, mci); if (!devres_open_group(&pdev->dev, NULL, GFP_KERNEL)) { + edac_printk(KERN_ERR, EDAC_MC, + "Unable to get managed device resource\n"); res = -ENOMEM; goto free; } @@ -346,8 +337,9 @@ static int altr_sdram_probe(struct platform_device *pdev) goto err2; } - if (regmap_write(drvdata->mc_vbase, DRAMINTR_OFST, - (DRAMINTR_INTRCLR | DRAMINTR_INTREN))) { + /* Infrastructure ready - enable the IRQ */ + if (regmap_update_bits(drvdata->mc_vbase, priv->ecc_irq_en_offset, + priv->ecc_irq_en_mask, priv->ecc_irq_en_mask)) { edac_mc_printk(mci, KERN_ERR, "Error enabling SDRAM ECC IRQ\n"); res = -ENODEV; @@ -400,12 +392,6 @@ const struct dev_pm_ops altr_sdram_pm_ops = { }; #endif -static const struct of_device_id altr_sdram_ctrl_of_match[] = { - { .compatible = "altr,sdram-edac", }, - {}, -}; -MODULE_DEVICE_TABLE(of, altr_sdram_ctrl_of_match); - static struct platform_driver altr_sdram_edac_driver = { .probe = altr_sdram_probe, .remove = altr_sdram_remove, diff --git a/drivers/edac/altera_edac.h b/drivers/edac/altera_edac.h new file mode 100644 index 0000000..b744d91 --- /dev/null +++ b/drivers/edac/altera_edac.h @@ -0,0 +1,116 @@ +/* + * + * Copyright (C) 2015 Altera Corporation + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . + */ + +#ifndef _ALTERA_EDAC_H +#define _ALTERA_EDAC_H + +#include +#include + +/* SDRAM Controller CtrlCfg Register */ +#define CV_CTLCFG_OFST 0x00 + +/* SDRAM Controller CtrlCfg Register Bit Masks */ +#define CV_CTLCFG_ECC_EN 0x400 +#define CV_CTLCFG_ECC_CORR_EN 0x800 +#define CV_CTLCFG_GEN_SB_ERR 0x2000 +#define CV_CTLCFG_GEN_DB_ERR 0x4000 + +#define CV_CTLCFG_ECC_AUTO_EN (CV_CTLCFG_ECC_EN | \ + CV_CTLCFG_ECC_CORR_EN) + +/* SDRAM Controller Address Width Register */ +#define CV_DRAMADDRW_OFST 0x2C + +/* SDRAM Controller Address Widths Field Register */ +#define DRAMADDRW_COLBIT_MASK 0x001F +#define DRAMADDRW_COLBIT_SHIFT 0 +#define DRAMADDRW_ROWBIT_MASK 0x03E0 +#define DRAMADDRW_ROWBIT_SHIFT 5 +#define CV_DRAMADDRW_BANKBIT_MASK 0x1C00 +#define CV_DRAMADDRW_BANKBIT_SHIFT 10 +#define CV_DRAMADDRW_CSBIT_MASK 0xE000 +#define CV_DRAMADDRW_CSBIT_SHIFT 13 + +/* SDRAM Controller Interface Data Width Register */ +#define CV_DRAMIFWIDTH_OFST 0x30 + +/* SDRAM Controller Interface Data Width Defines */ +#define CV_DRAMIFWIDTH_16B_ECC 24 +#define CV_DRAMIFWIDTH_32B_ECC 40 + +/* SDRAM Controller DRAM Status Register */ +#define CV_DRAMSTS_OFST 0x38 + +/* SDRAM Controller DRAM Status Register Bit Masks */ +#define CV_DRAMSTS_SBEERR 0x04 +#define CV_DRAMSTS_DBEERR 0x08 +#define CV_DRAMSTS_CORR_DROP 0x10 + +/* SDRAM Controller DRAM IRQ Register */ +#define CV_DRAMINTR_OFST 0x3C + +/* SDRAM Controller DRAM IRQ Register Bit Masks */ +#define CV_DRAMINTR_INTREN 0x01 +#define CV_DRAMINTR_SBEMASK 0x02 +#define CV_DRAMINTR_DBEMASK 0x04 +#define CV_DRAMINTR_CORRDROPMASK 0x08 +#define CV_DRAMINTR_INTRCLR 0x10 + +/* SDRAM Controller Single Bit Error Count Register */ +#define CV_SBECOUNT_OFST 0x40 + +/* SDRAM Controller Double Bit Error Count Register */ +#define CV_DBECOUNT_OFST 0x44 + +/* SDRAM Controller ECC Error Address Register */ +#define CV_ERRADDR_OFST 0x48 + +struct altr_sdram_prv_data { + int ecc_ctrl_offset; + int ecc_ctl_en_mask; + int ecc_cecnt_offset; + int ecc_uecnt_offset; + int ecc_stat_offset; + int ecc_stat_ce_mask; + int ecc_stat_ue_mask; + int ecc_saddr_offset; + int ecc_daddr_offset; + int ecc_irq_en_offset; + int ecc_irq_en_mask; + int ecc_irq_clr_offset; + int ecc_irq_clr_mask; + int ecc_cnt_rst_offset; + int ecc_cnt_rst_mask; +#ifdef CONFIG_EDAC_DEBUG + struct edac_dev_sysfs_attribute *eccmgr_sysfs_attr; + int ecc_enable_mask; + int ce_set_mask; + int ue_set_mask; + int ce_ue_trgr_offset; +#endif +}; + +/* Altera SDRAM Memory Controller data */ +struct altr_sdram_mc_data { + struct regmap *mc_vbase; + int sb_irq; + int db_irq; + const struct altr_sdram_prv_data *data; +}; + +#endif /* #ifndef _ALTERA_EDAC_H */