Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756402AbbEUU7G (ORCPT ); Thu, 21 May 2015 16:59:06 -0400 Received: from mail-bn1on0116.outbound.protection.outlook.com ([157.56.110.116]:16544 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756218AbbEUU7C (ORCPT ); Thu, 21 May 2015 16:59:02 -0400 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=scottwood@freescale.com; Message-ID: <1432241934.27761.230.camel@freescale.com> Subject: Re: [PATCH v2] mtd: fsl_elbc_nand Add ECC mode selection in DT From: Scott Wood To: Tomas Hlavacek CC: , , , Date: Thu, 21 May 2015 15:58:54 -0500 In-Reply-To: <1432208791-20734-1-git-send-email-tmshlvck@gmail.com> References: <20150507231530.GT32500@ld-irv-0074> <1432208791-20734-1-git-send-email-tmshlvck@gmail.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.10-0ubuntu1~14.10.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Originating-IP: [2601:2:5800:3f7:12bf:48ff:fe84:c9a0] X-ClientProxiedBy: SN1PR05CA0021.namprd05.prod.outlook.com (25.163.68.159) To BLUPR03MB1473.namprd03.prod.outlook.com (25.163.81.158) X-Microsoft-Exchange-Diagnostics: 1;BLUPR03MB1473;2:pKD2swTvCk1p2jTtUTx5qp/OXebI9hYljgR2hm/hs2VQCdU1T7WLDaOibxy0k0hE;2:cWloP8wWVPeTWcL6RF8qfTww4/aW3lAkiOG+Fr4GKv6x9SDikVBIvvc9d/nHLH71BSPcwT0hDu6MVRlMdF2OAoDirckZQJekDMIT+SvH3ndVc5i7dSoQqOq4M9UYYMcFirPdzUflYrSn7CnB4ubsJA==;6:cEI4swq0n8eJomZzsWwwc2ZTDDck4Sjbfzqq4F16NOYqH41IzHTXAosll4QyWR94R+d/N0Wf2OhkSluVxxMAf5fVebSKp99+eMBoCtl7FBM1zaVN5Twe9tzI58tzr4184GNBLtbQofnRZhK8Y/i+VLHEJzPr3aOHIy+yKXzW3U2hp/SHHwOpHCPtqa/70MJZaPPAeaZY6EYzzcPZsKIc9NI0LYmi2/ZX6HTWHHCuUKh2ynKa7/xISCSov/FiK6000/B6rcz7UymM3eNt7pk7s2UnsDRTQ/InDAceZDedGp6c9h4Xw0kH4cUiG2ly5kFw+uXqzzxYToHQN29M+xUvzH0MwXBFXD+cr9amaLapGfFAkARpI5hZiSSqZm7KdudYG9rzqYB548Tx8/4+NDR+745RfZddLUF+cY7OcM3bV3te1Rh6a/QvM3czTO3QRyq1aYjq3/RAhY/7oDfnGRqwbMlwuDVLk668jGP7LKEOH4/rFJcqCcIK4lR91EI7oryu X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR03MB1473; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005006)(3002001);SRVR:BLUPR03MB1473;BCL:0;PCL:0;RULEID:;SRVR:BLUPR03MB1473; X-Microsoft-Exchange-Diagnostics: 1;BLUPR03MB1473;3:gELmj1/jzilpk/F8RADDml88UWwukXqnTSSnJ1sdY6F8keKO4qDKBR8x3HyUxuan2vwuvQBvpGTL1lfAu5sEHYrgZHgyJuFgAbCanpGcmYKkuZT+Wkid8mbRziqrOQwva80iuEIPDpIWsy0ecX1c3+hc0vz17PKu8CVGvY6IsJlVq7LydzkhPNbnYkRb8NjnPO+JtMDBpl//QkYFZXX9QcGaMMxyWmqy5ktfzNrFa0Rrzb9onJXXQss4eolKpxYAJLe7RvuE/1BEmRNbVDuZ+tBo+OYT1DOFgqn7OIch7Ao= X-Forefront-PRVS: 0583A86C08 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6009001)(377424004)(189002)(199003)(24454002)(106356001)(103116003)(5001860100001)(5001830100001)(50466002)(19580395003)(110136002)(23676002)(36756003)(97736004)(122386002)(2950100001)(5820100001)(86362001)(47776003)(46102003)(81156007)(4001540100001)(101416001)(87976001)(105586002)(189998001)(1411001)(33646002)(42186005)(5001960100002)(92566002)(68736005)(77156002)(64706001)(77096005)(76176999)(50986999)(62966003)(50226001)(40100003)(99106002)(3826002)(5001840100002);DIR:OUT;SFP:1102;SCL:1;SRVR:BLUPR03MB1473;H:[IPv6:2601:2:5800:3f7:12bf:48ff:fe84:c9a0];FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCTFVQUjAzTUIxNDczOzk6Rk95QURaN2xISS9LcEdvdXFxc0IxNzF5cnZ4?= =?utf-8?B?M25SNEt6bDEvMWRrNmtPcDBKRTZRNUJucnFTQzdrN3lTUXRDbzFVZnhxektL?= =?utf-8?B?MXlIVW4rL0hVMnNNcnhXVG9tUHRFNXdTRUFUaHd2WlJmRUYrSGszUitIUlNR?= =?utf-8?B?emUrNThjaE5tMW5wNWJXRm51VEpVT3hSY3NKR29KbDlHMlZRMVNQK29OSWVX?= =?utf-8?B?L2xJbVh3Mm02bW5TT2Q2L1lVMXY4RjN1Y3ZCZCtiZm9RdllVcHc2dzEwUXNy?= =?utf-8?B?YnRhSkNsOWMzUERyUENGaFFmSld6cGR4c3V0czNnWVB5KzhXZkxBMXNKWWd2?= =?utf-8?B?bWxkckFCcU12Nk9jdXN1UEZIcHhnUWVvV1EzSFI2Q1hOTVFwWmZCaldnT1VK?= =?utf-8?B?cUprbjVBdWl5Y2M0TUcvd1AyUHNGSHVOR1RzUXJqM0krdHJYWmUxTVJoSEow?= =?utf-8?B?NURjaGVOelJvekRpT0NOY3NYL051RHMzWENBWC84RHlBRmVjdEp6ZzZBUENB?= =?utf-8?B?QmI2NTF2WWpZRlB3OVBCNWF5b0w3QWttTEdOc2FvaVN1OCt2b1Z4TWErUjR3?= =?utf-8?B?Y3VsbEhTMjU3U2p2RVZFdkhzcmV2enBFOGNUeVdPW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b0FJNTlONU1SZGt5QWJQRW5WTUFYM00rYTlSbndJdjFjS1Bk?= =?utf-8?B?clhNaStXR3B5U0lLSHdNbFRFSE1uUT09?= X-Microsoft-Exchange-Diagnostics: 1;BLUPR03MB1473;3:GIymoEqB+VjJMhW/c+WwIAJHEREkoHxCUbtorpdnTZ0cUTRJRpp3hJWFp00MK4HcVScZGrtYiHelmEnwidulNEvNz5qU5+zxWFdJ+qyELyYUoJE2Pz5VU++erF/xcnuE7QVn1HUJVTHK+dpz0gnazg==;10:bYYXiYOR5C68Tw2xGLaZ0REHp0z5U3rAthN0l6z02xV8BN5DS1oFBUJHNoJRd6XXDd2n49InumFCdbNqyNoolM/SAS6LiZEZpd6CQSxhJ8Q=;6:wyloxkOr+cNI7FrvZHnpq7neJKfAiIAG2Ehz/MfCUMkIdcIu/ejxFu5YwZaMGXmN X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 May 2015 20:59:00.1441 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR03MB1473 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1882 Lines: 45 On Thu, 2015-05-21 at 13:46 +0200, Tomas Hlavacek wrote: > Add device tree pointer to chip structure in order to allow turn off the > HW ECC and force own ECC mode and ECC parameters. Newly supported entries > are as per documentation: nand-ecc-mode, nand-ecc-step-size > and nand-ecc-strength. If you're using these properties with eLBC, the eLBC binding needs to be updated to say that they're allowed for use with software ECC. > @@ -677,8 +689,8 @@ static int fsl_elbc_chip_init_tail(struct mtd_info *mtd) > priv->page_size = 1; > setbits32(&lbc->bank[priv->bank].or, OR_FCM_PGS); > /* adjust ecc setup if needed */ > - if ((in_be32(&lbc->bank[priv->bank].br) & BR_DECC) == > - BR_DECC_CHK_GEN) { > + if (((in_be32(&lbc->bank[priv->bank].br) & BR_DECC) == > + BR_DECC_CHK_GEN) && (chip->ecc.mode == NAND_ECC_HW)) { There's no need to check both. If you're selecting software ECC in the device tree then you must also remove ECC checking from BRn. If you want to make Linux write to BRn to ensure that it's consistent with ecc.mode after the DT init, fine, but don't just silently proceed without fixing it if there's an inconsistency. > @@ -786,6 +801,7 @@ static int fsl_elbc_chip_init(struct fsl_elbc_mtd *priv) > chip->ecc.size = 512; > chip->ecc.bytes = 3; > chip->ecc.strength = 1; > + chip->ecc.write_subpage = fsl_elbc_write_subpage; > } else { > /* otherwise fall back to default software ECC */ > chip->ecc.mode = NAND_ECC_SOFT; ...but here you are relying on BRn to be set correctly before nand_dt_init(), so I'm even more confused by what the previous change is for. -Scott -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/