From patchwork Sat Aug 24 14:51:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elie De Brauwer X-Patchwork-Id: 269640 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 2D22B2C009A for ; Sun, 25 Aug 2013 00:58:03 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6D8F64A08E; Sat, 24 Aug 2013 16:58:00 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IqL8k0k7TCGH; Sat, 24 Aug 2013 16:58:00 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id AA57D4A08F; Sat, 24 Aug 2013 16:57:58 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6724A4A08F for ; Sat, 24 Aug 2013 16:57:52 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SGEGpeCke3Pw for ; Sat, 24 Aug 2013 16:57:47 +0200 (CEST) X-Greylist: delayed 370 seconds by postgrey-1.27 at theia; Sat, 24 Aug 2013 16:57:41 CEST X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-ea0-f175.google.com (mail-ea0-f175.google.com [209.85.215.175]) by theia.denx.de (Postfix) with ESMTPS id 4EF7C4A08E for ; Sat, 24 Aug 2013 16:57:41 +0200 (CEST) Received: by mail-ea0-f175.google.com with SMTP id m14so784298eaj.20 for ; Sat, 24 Aug 2013 07:57:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=S2RwNQEzmRcoztEWXmqDrN98hsD9Q3fjmUSWWTN84Ss=; b=0wCnnsuMl2tz284zzn34cz9iZkrGb810YUo0EeztXHSbUIc/ER0C6zt2RylPbdmwF2 oTCvHZBgnigoQxYNxjR2NW7e/0uAUYkQ7k3oVpOYw6XAN77xUSLForLllVfAK42w02Zm NyIxdhwI7pG4VgcvNgLPfmKMH8uAmD0SlRljfgQIZnNYswuc5W5p0FWfYo5oxbIKYPZz NbOfhv7YVy7Q40NR5fQ9bggNE1O7sKevxg9ZrjY7UGrIXRUiDj9ClLmspo7i73J99amJ 98HFES4yUsRCnlD1nOHD8iO/7J0+Vnvhrs6UjIJsDHV7WRZ4zfaLcUc7DZ0VhGJlBk5H PPZw== X-Received: by 10.15.64.1 with SMTP id n1mr8635935eex.15.1377355890185; Sat, 24 Aug 2013 07:51:30 -0700 (PDT) Received: from lapelidb.telenet.be (dD576B3C8.access.telenet.be. [213.118.179.200]) by mx.google.com with ESMTPSA id f49sm7319716eec.7.1969.12.31.16.00.00 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 24 Aug 2013 07:51:29 -0700 (PDT) From: Elie De Brauwer To: u-boot@lists.denx.de Date: Sat, 24 Aug 2013 16:51:24 +0200 Message-Id: <1377355884-5920-1-git-send-email-eliedebrauwer@gmail.com> X-Mailer: git-send-email 1.7.10.4 Cc: scottwood@freescale.com Subject: [U-Boot] [PATCH] mxs_nand: Fix ECC strength for NAND flash with OOB size of 224 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de On a board with an i.mx28 and a Micron MT29F4G08ABAEAH4, Linux says: NAND device: Manufacturer ID: 0x2c, Chip ID: 0xdc (Micron MT29F4G08ABAEAH4), 512MiB, page size: 4096, OOB size: 224) the ECC strength is 16. root@(none):/sys/devices/virtual/mtd/mtd0# for i in ecc_strength oobsize subpagesize; do echo $i = `cat $i`; done ecc_strength = 16 oobsize = 224 subpagesize = 4096 The ECC strength was not properly discovered by U-Boot causing the data written by Linux to return an -74 (EBADMSG) when read from U-Boot. This patch fixes mxs_nand_get_ecc_strength() to function in case of a NAND flash with page_data_size = 4096 and page_oob_size= 224. Signed-off-by: Elie De Brauwer Acked-by: Scott Wood --- drivers/mtd/nand/mxs_nand.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/mtd/nand/mxs_nand.c b/drivers/mtd/nand/mxs_nand.c index 378f8c5..036c113 100644 --- a/drivers/mtd/nand/mxs_nand.c +++ b/drivers/mtd/nand/mxs_nand.c @@ -155,6 +155,9 @@ static inline uint32_t mxs_nand_get_ecc_strength(uint32_t page_data_size, if (page_oob_size == 218) return 16; + + if (page_oob_size == 224) + return 16; } return 0;