From patchwork Wed May 13 21:49:45 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: 6400471 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3B9769F1C2 for ; Wed, 13 May 2015 21:52:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B0FC2203DA for ; Wed, 13 May 2015 21:52:43 +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 388B720270 for ; Wed, 13 May 2015 21:52:42 +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 1YseXO-0000Gm-RY; Wed, 13 May 2015 21:49:58 +0000 Received: from mail-by2on0055.outbound.protection.outlook.com ([207.46.100.55] helo=na01-by2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YseWo-0008II-Iw for linux-arm-kernel@lists.infradead.org; Wed, 13 May 2015 21:49:24 +0000 Received: from CO2PR03CA0021.namprd03.prod.outlook.com (10.141.194.148) by BY1PR03MB1498.namprd03.prod.outlook.com (10.162.210.144) with Microsoft SMTP Server (TLS) id 15.1.160.19; Wed, 13 May 2015 21:48:58 +0000 Received: from BY2FFO11OLC014.protection.gbl (2a01:111:f400:7c0c::130) by CO2PR03CA0021.outlook.office365.com (2a01:111:e400:1414::20) with Microsoft SMTP Server (TLS) id 15.1.136.25 via Frontend Transport; Wed, 13 May 2015 21:48:58 +0000 Authentication-Results: spf=fail (sender IP is 66.35.236.236) smtp.mailfrom=opensource.altera.com; vger.kernel.org; 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 BY2FFO11OLC014.mail.protection.outlook.com (10.1.15.48) with Microsoft SMTP Server (TLS) id 15.1.160.8 via Frontend Transport; Wed, 13 May 2015 21:48:57 +0000 Received: from na01-by2-obe.outbound.protection.outlook.com (207.46.163.236) by webmail.altera.com (66.35.236.236) with Microsoft SMTP Server (TLS) id 14.3.174.1; Wed, 13 May 2015 14:47:48 -0700 Received: from DM2PR03MB430.namprd03.prod.outlook.com (10.141.85.14) by DM2PR03MB365.namprd03.prod.outlook.com (10.141.55.12) with Microsoft SMTP Server (TLS) id 15.1.160.10; Wed, 13 May 2015 21:48:56 +0000 Authentication-Results: alien8.de; dkim=none (message not signed) header.d=none; Received: from tthayer-HP-Z620-Ubuntu.altera.com (64.129.157.38) by DM2PR03MB430.namprd03.prod.outlook.com (10.141.85.14) with Microsoft SMTP Server (TLS) id 15.1.166.19; Wed, 13 May 2015 21:48:54 +0000 From: To: , , , , , , , , , , Subject: [PATCH 2/4] edac, altera: Refactor EDAC for Altera CycloneV SoC. Date: Wed, 13 May 2015 16:49:45 -0500 Message-ID: <1431553787-27741-3-git-send-email-tthayer@opensource.altera.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1431553787-27741-1-git-send-email-tthayer@opensource.altera.com> References: <1431553787-27741-1-git-send-email-tthayer@opensource.altera.com> MIME-Version: 1.0 X-Originating-IP: [64.129.157.38] X-ClientProxiedBy: SN1PR12CA0028.namprd12.prod.outlook.com (25.162.96.166) To DM2PR03MB430.namprd03.prod.outlook.com (10.141.85.14) X-Microsoft-Exchange-Diagnostics-untrusted: 1; DM2PR03MB430; 2:qIANMWBAnCPkuQQbwtKTCOtJKHUgqQOie/u81sLhhJxxi/7aLrN1hsuxouOXfipY; 2:T2P71fw3l07H+N1LVh09isiepQkaGiO65o/91t7y+Z5dRstDDXxl9eYOfHKRHkT8AzZE6Ul1FG6hSu1UDb/uRoFRud5zGsbK0OCIztAzqXPx00jszNsHnoU/0p9TF2BQW7WB+XOKAi92bqdvM6FeMQ==; 6:53hpuRUIO/2OcOngY2OpwyzkeoDutt6snDYUI917t9NSlzpCUU95Ux8H+2UY3DPsZOgiz+jqHXoo7/Hz5KXdagE4w9X/ondbA5+0+ICd+wpMr/mGrSqh/lpaBTcxSGuyEFV3/ftxzWYPQD0pJ1Dndw==; 3:HHhO6TOSZmdJkpwyOnEt9dn+kLgww/XF9HVwqRalLYkodF7a4TE9PJhflgVyqoJw55G+eUGQeU79a4WUrodx6TclNGeJcoDfve9TxqGiwyKrxDSWUzkgAKMC9JBL6ps3tIaRibavdFVTwI/8dBsUhx9iEJP8TWVKpY/+v1FxKC+FMyftU6QcF0ojukSEmTaen2CcFfNIe5FPb0ObgVMnfTV/HMpLR9fXn0iMie++f7fin949sgPJSi1RcAkyrjWtj+0vmfFaa+MBxCUxnkg+aCRloZ5+abuAjm+nryDG8tU= X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:; SRVR:DM2PR03MB430; UriScan:; BCL:0; PCL:0; RULEID:; SRVR:DM2PR03MB365; UriScan:; BCL:0; PCL:0; RULEID:; SRVR:BY1PR03MB1498; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:;UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(3002001); SRVR:DM2PR03MB430; BCL:0; PCL:0; RULEID:; SRVR:DM2PR03MB430; BCL:0; PCL:0; RULEID:(601004)(5005006)(3002001); SRVR:BY1PR03MB1498; BCL:0; PCL:0; RULEID:; SRVR:BY1PR03MB1498; X-Forefront-PRVS: 0575F81B58 X-Forefront-Antispam-Report-Untrusted: SFV:NSPM; SFS:(10009020)(6009001)(76176999)(47776003)(189998001)(33646002)(50226001)(50466002)(46102003)(87976001)(86152002)(2201001)(92566002)(575784001)(86362001)(62966003)(2950100001)(77156002)(107886002)(5001960100002)(50986999)(122386002)(19580405001)(40100003)(19580395003)(5001770100001)(48376002)(15975445007)(66066001)(229853001)(77096005)(42186005)(53416004)(2004002)(921003)(1121003)(4001430100001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR03MB430; H:tthayer-HP-Z620-Ubuntu.altera.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics-untrusted: =?us-ascii?Q?1; DM2PR03MB430; 9:jWyu2Mahmz/nT2JcNQrwImSElCkAf1eOkhiiL7OK48w?= =?us-ascii?Q?l1HCdFclncBZheaXqPoh2LdwNuOijxYu8+lR8w7d/wsiY3EyrEXHciUQWoW2?= =?us-ascii?Q?WmfzZGwk0TgeSdlVu8XwyV2kwojd/M24o74lic6W9Y0zyd+KcDiZsXl4kGXd?= =?us-ascii?Q?1SStjGXIi50sToe8riDjIpXMie4GBL3uhMU05VqywsG/ih56DRBGT2Uj80g0?= =?us-ascii?Q?+doAxtu4Ly9G8Vk/6hW80QoSYAD9IdmuEeFAkSf0lc0TrK3WZk4/ae4ttZbR?= =?us-ascii?Q?N/wjz5O5j3aFrIt/MOTQVdGaL9w1KC8ed5fX+nOlUpH45XrQMJP0+VaT8Er9?= =?us-ascii?Q?RCM3AZqAmaQ7oR86SeAWWiQ+AhGdQUwQVY4qt0GF8EyP0kaDjzUviUALIUVX?= =?us-ascii?Q?qpiSa+miuhztXisOsPTlg+9r6k5sstNAuAld3SBclAfovNF/9nnwRU2mCr2K?= =?us-ascii?Q?1h2By6N5vn9VsrpmeC09qPbLlJJ+OuGW0QaqURQgnOnJEZzr27rwfAPfNyhN?= =?us-ascii?Q?JVOSB39Us3epoMc7nbFR2SH78BwFWJM/mPUIMd2jkDR/kzj2fft+fU+ecHmW?= =?us-ascii?Q?UMJfuJcF4FjtkGOSsSTrUCXxT2f6VJdwjeJo56pzvogFN/SCS4sEfec8m5up?= =?us-ascii?Q?ogFXRF9iDItXdEFjO6bpmMRZBpb5nW4Imx45SQt1RFHW6yZUOW90eZX5enkl?= =?us-ascii?Q?zYD9nO2RaWwTfTR4j0K7ok+LdbdUwHWRsByUB0HRnhR3e/G4geM3E4YcUZtK?= =?us-ascii?Q?RENoZ2iLJsjS+TJmdqgzPgx/cPi+YSp2aUyFkn6z4epY9DZz6gnmMJtYr5Sv?= =?us-ascii?Q?mbhb3dMw32UoyOkxk5NBB+oZ5RtDCBJjxwcyujjmSr98rqfxSKJZE1i7cd0L?= =?us-ascii?Q?YE4phGVD5H7bVhPs/jBQxaxc0GnFbhLrUFvWMcprKjPemuzPWTxSwKzpO1DH?= =?us-ascii?Q?+qWDc7KBWh3eGB367g3CgGkBSXi4++7IzCZ77/Q=3D=3D?= X-Microsoft-Exchange-Diagnostics-untrusted: 1; DM2PR03MB430; 3:IVfCQfg0Yr5dClP7f+E5TeuXXgj4uZdbddzCZXxwUnqoHeryyjKJ6cHvCENP4wmGmYrO3pLgJxCxlKrV7M5gQKoY927AJPM9D2IV26iHKowOen/po0y6XHpDLct70lAAwiA2w6VbPmpyY/jZN/Ecrg==; 10:PCqImSzUkmJzXaxBKPSSHjha1zg/Sk4vvMiuakt6uSCj+DOaHoNVMK97wl1sWEQjK8o9T9XHIiIlbeiul3f4A3NGiLMqs9rJ25EdFFepB3o=; 6:6actpM80LupF5ipdYA4LjZKC0X449+KF7fSxJMqRzOmuKHYRnfhWabpQyprwQ4wSyja9zsNAL7A2V4dwMGhSK5CMoSsMR1JRPa3t52eDkmxXDTa5hSSVhD9bAguiaFBT8vB8MnSw+GsW9QlAQb6A4Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR03MB430 X-Microsoft-Exchange-Diagnostics-untrusted: 1; DM2PR03MB365; 2:PccvDdoqfpPM2fzXxvMGmoeVcBQ/K3vPJPKds5+BcA4VBh37HQL/cazUzGjqTCTh; 2:AgFkgEez0ijaVKjbBGV3cBww8GMTWA19kTHEabfMAIyv6H6ThP7tNkWrtqISzf7zcV3O0JvEwlexOuZFAeyQkDLgsINuuuIEw37ir/iagtebcsOhCX9jo00kDbQ3l6CKB2k6Uk8LQumbnInKtr5CHw==; 9:siDNoFPWIPxPKSxvgumX/06EPgLsdZHBojv7ZaUeRbe5YqlNWJFy8yDxRE9mbMdgeZ54Yz/k7r1QVYn8lVFoaSF4FOGpFL03pqz3vHWO4dAbRIKnFoi09a91G3Oat0xzF8e5Rn6V8s5fL+mMraBdVg== X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: BY2FFO11OLC014.protection.gbl X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11OLC014; 1:AeBe6Ulu3Qb4oQw3WaSIfuV2RZKPgRFVwSLTTk4uA02CIW9DgqVbQRodK0PHeBKfbXStV1F/WSF33/fOcllrCD6qIUDHD7iakK3beVPnSGEq6Upc4RA0ExQvrnR7yK4W4SITNHwcLoYcp93ZwgQjW8rI6qMGWTEd7toGfdlvjnN7TpneUPRcoGZtTJ0n0z2fmDJq3vO90NMFEHsRrWy/mrMo6TURowA0uz83CaoIx14agW2rhFR7VO+40Fn2yVGOFKX2obwInczJrShUMwlLNLCFgbv6SvJ8VLMi1EyUXOMsJUwN//GDp2I0VDdUj3kP X-Forefront-Antispam-Report: CIP:66.35.236.236; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(339900001)(199003)(189002)(6806004)(76176999)(85426001)(47776003)(189998001)(33646002)(50226001)(50466002)(87936001)(46102003)(86152002)(2201001)(92566002)(575784001)(86362001)(62966003)(2950100001)(77156002)(107886002)(5001960100002)(50986999)(122386002)(105606002)(19580405001)(40100003)(19580395003)(5001770100001)(48376002)(106466001)(15975445007)(66066001)(81156007)(229853001)(77096005)(53416004)(7099028)(2004002)(921003)(1121003)(4001430100001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY1PR03MB1498; H:sj-itexedge04.altera.priv.altera.com; FPR:; SPF:Fail; MLV:ovrnspm; A:0; MX:1; PTR:InfoDomainNonexistent; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY1PR03MB1498; 2:YYkvF994RJL/49hO2Bdjetn67gMAi7HGYmzHQ11H0J4+GbTg5aRtsLLJuTsl4HbJ; 2:y+ltqTQDM4ZE7BfFQSeT8wKgJ3r5uuLB/OKyEc5QDuS0dS41qKmz+Jene/JtAZy8jUuOLC5kyCq6uFUSnrBopz9bmbNN0b6prNujEEmzv4/DCEuiVdVIt+MWTQieSDajGP4clUoMLF9W8ZlrfG5Iw/6tdY4RsTWMT9s7H+qk1RHQvPS3T2cXBTaUkBcvGXEcxdFFIegipUj8T1Kl1H57HmpopBfgEyViev/xNp4lG6w=; 6:IQAqJu4d1TJCOS99hqCVgQnzZrSlvKHlBthpKD9eQsVXtK3zv/brnyJFsmTGnpDHBySn/+/lLk78324mhtiw9nBu/9j3axrs/Fr2dqD8eghw5GyWXRxG4zmPEs4aowgwHj2BFzOexx+IpKwHYQqG3g==; 3:dFatDu28i8xHjHq/MlqWb5XBxgGsjqiA9EMyb4hf9yYzxt1U2Wm3tBHQttcfFhvx8FKqrXvEzg5Nx7OyRnDmGZ1PG/61encLDkpvaIVPC8uZ2Ew6CdfQZpZ1+FEcENpWrjirX3ChEjQXp61JW6/2aihIRwCEa4v5mOMa195c4CpIORPJ760oRLmcBUensvEg9zImTC8FgLQvULkzvl3YTUerjG77oliFOXzekaoC+X8tdlCUioplzexJuE6M5dBq+iIBb4XCJ/6dwm0EtZeX0Kxdik8DjAfbxcUkdZ/DZwE= X-Forefront-PRVS: 0575F81B58 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY1PR03MB1498; 9:FN5rMCGD60ToTWx1tw2/yo0uTJBaUVP15DoWZXJNuH?= =?us-ascii?Q?W4udS+kwChTslsT91LzxmG/4II02hh3WbqeiHFBZaH9Ukw3Omdax036E5ZGW?= =?us-ascii?Q?vB3T41eqzK6P4iJgAyAHnfMYEXNXOl6kLfVN8tW31CXjAy+O4I1fOtu0sBxq?= =?us-ascii?Q?RAejNobSybfM0nTT/w9XegTtjo2JGZUGPBl3KPJ4TX5WW8Zl0M9bTIHSV4Pf?= =?us-ascii?Q?HrLp4bR5UbUCwHxPYYBpdRsLbMxb1gRwM7/ElLZd2dbACkK96WXs9FRc1SOy?= =?us-ascii?Q?2LKL3yPyPLKg0a1QSk9v9Zbn30Nz42edyrukLf7DGUSNw6YqTkOnDTmlEegT?= =?us-ascii?Q?Yj+pUn6QgQl40zHJonx95d9zqNwGlSbdKSwjvzG4TeSpJ2LL/fgilY3d0x2H?= =?us-ascii?Q?88EkoQSERHuh71YRPiMwWcyKMT1QOrKHW2x0ucaWSDvmfOlLhW/nKygZt+E1?= =?us-ascii?Q?TSUIyzM4vrmUWUQm3b+Ehb+THXsoi5A8u0kwND4yjrzeCRWFOccvRRklotEK?= =?us-ascii?Q?9i4vnfK+2nlIbknwkZEwg00GQtU9fvheZ6jf80IPRFWeOPFrc8ei7ifFf9Qs?= =?us-ascii?Q?25P2ft5fW+IUGwCh0CiwH75ZkWd9kreFP1CR8tTzO7RlHcQG9MbhhMOHTf3R?= =?us-ascii?Q?4H+SYLYYvbTexj3Fj00So6WHZ6k28iNXbq0h26dY8Jw9okJSNZ9y/mbI6tdz?= =?us-ascii?Q?X8X/16+rC6Y5nOnUFUTcy4DbE/iI+KtROv3mwhMsJEW4+voLf6xWn/oOR8fS?= =?us-ascii?Q?BzZyZjM/DXNrFA+0c8h4fy5cSoY6usONFnqSqkP974yQxUhHLiBIap9Fvfd0?= =?us-ascii?Q?1IAZbzh3Kh6hzFrvdq7f59N81kJS3EBR6lgCct12QGtvTCjBO+WfcnQsbIhO?= =?us-ascii?Q?tRU+ktS6yEbV9xxTxrCmKMcUUqIcd00nkqomJGDqX8vqQhlBIa7J59kWQhjx?= =?us-ascii?Q?kZA1EzDv5eUkZXMoV9ci1f0wma5ijj6n9wb/+3G9z1ojHrawuMx+JL5LvqEs?= =?us-ascii?Q?IPVAj8BvrKv3Qkw/9YWMcw6AUi23CytzWTAMQqgB0iQr4OW5KIyYXzQq+sAM?= =?us-ascii?Q?+M5kwY31AIeqETm9iF5zruoDhB7uzBA9c27bxEGqW1gE1GPKE+sTEsiGrMue?= =?us-ascii?Q?Ohl7ZjKRA=3D?= X-Microsoft-Exchange-Diagnostics: 1; BY1PR03MB1498; 3:qdebgxx39434yoQWSLWuLs7S8v414P+u4LI9CqeHSsZ6Ti2uxi5Jm1AqsvIa4q8m9UHYN7TOMi8mffaVUOHwjuh5x8SD9vCcV38GCDMK/9INqhHc8Y5Dk9li4NMw3fmvrU9+2U0ha/k6tPM/jINa5w==; 10:AfVvBfS2N4tpvC7FowdEb8HoLtbamYvLlEZm3tnHnQKxCY5Qyi5Zjz5juZRWdCyJnynA6vnCTtk28Hfs95O+WkbkX1x2aBsWP3PKzJJLl10=; 6:SsKl0RWmvpU8eC2j/O5Rm7U8d+9HYuK49bAEksJ437pt/9s5UlhsWUIo+tuyEk4qOZAQpzVGL9j00LmycY4/n6BwpjhDu02HtSoNyMfySxfq1tj28FqxhnqXiUrSUcfwGJSus/dREmSvzA8srvazQA== X-OriginatorOrg: opensource.altera.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 May 2015 21:48:57.4547 (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: BY1PR03MB1498 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150513_144922_712425_60897862 X-CRM114-Status: UNSURE ( 8.40 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.0 (/) 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 --- 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 e18a205..204ad2d 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; +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(); @@ -250,18 +205,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"); @@ -271,8 +237,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; @@ -286,10 +257,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; } @@ -314,9 +302,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; } @@ -350,8 +341,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; @@ -387,12 +379,6 @@ static int altr_sdram_remove(struct platform_device *pdev) return 0; } -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 */