From patchwork Thu Sep 18 14:08:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 37588 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f71.google.com (mail-ee0-f71.google.com [74.125.83.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A19342054E for ; Thu, 18 Sep 2014 14:10:30 +0000 (UTC) Received: by mail-ee0-f71.google.com with SMTP id e53sf688101eek.10 for ; Thu, 18 Sep 2014 07:10:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=8hUTkpMWaTFggtp8gWhchEQU0t6UIGwduBRSJlZ7V14=; b=is3NvzM8M3uTixP4aiPooPIGUnHquv8PhTWJS/XxCGPxfCM9bqVZHUtJktjrseo5e5 XyVA1ZDXRFX7sjbIwW5xx4F1s+KFgf5v7RmZN2B0qSO+2yPn63AHVrvrSLDpWNDbREYU 7DYiTYJQ7WoHGlJVT1/InZTJJoeyplNxjWEA2TlrKzrvNqzAwGKF0zulsDycJXSUIfGB BTAmdMM57IbUMXkr02FWix1U/nOjsyCOlUwEOITa0WQ3Ga2c43SpKLj+2I0wHJ3ypaO4 z3Ra2EPw9NIO3xWEso60l167Qm5plQb/JrFZrYYSccjEsfZaYyJKOatqgUtX6fTx3bnG Ffrg== X-Gm-Message-State: ALoCoQlH3K8e0s8IVHF/u27TPIGwGI7IQQZJ4iPvT7vN3x4h70y3DK90lcF3AUVHPGOAcUrTLwnB X-Received: by 10.181.25.225 with SMTP id it1mr1486306wid.0.1411049429742; Thu, 18 Sep 2014 07:10:29 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.29.135 with SMTP id k7ls159255lah.78.gmail; Thu, 18 Sep 2014 07:10:29 -0700 (PDT) X-Received: by 10.112.156.138 with SMTP id we10mr26410lbb.68.1411049429629; Thu, 18 Sep 2014 07:10:29 -0700 (PDT) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com [209.85.215.43]) by mx.google.com with ESMTPS id kr4si19591115lac.72.2014.09.18.07.10.29 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 18 Sep 2014 07:10:29 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by mail-la0-f43.google.com with SMTP id gi9so1213799lab.2 for ; Thu, 18 Sep 2014 07:10:29 -0700 (PDT) X-Received: by 10.112.53.230 with SMTP id e6mr3578058lbp.100.1411049429564; Thu, 18 Sep 2014 07:10:29 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.130.169 with SMTP id of9csp762444lbb; Thu, 18 Sep 2014 07:10:28 -0700 (PDT) X-Received: by 10.66.222.74 with SMTP id qk10mr6234312pac.70.1411049379444; Thu, 18 Sep 2014 07:09:39 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j3si40041584pbw.2.2014.09.18.07.09.38 for ; Thu, 18 Sep 2014 07:09:39 -0700 (PDT) Received-SPF: none (google.com: stable-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756547AbaIROJg (ORCPT + 1 other); Thu, 18 Sep 2014 10:09:36 -0400 Received: from townshendhl-gw.townshend.cz ([193.165.72.158]:42005 "EHLO ip4-83-240-18-248.cust.nbox.cz" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1756351AbaIROIf (ORCPT ); Thu, 18 Sep 2014 10:08:35 -0400 Received: from ku by ip4-83-240-18-248.cust.nbox.cz with local (Exim 4.83) (envelope-from ) id 1XUcNp-00026R-EJ; Thu, 18 Sep 2014 16:08:29 +0200 From: Jiri Slaby To: stable@vger.kernel.org Cc: Roger Quadros , Tony Lindgren , Jiri Slaby Subject: [patch added to the 3.12 stable tree] mtd: nand: omap: Fix 1-bit Hamming code scheme, omap_calculate_ecc() Date: Thu, 18 Sep 2014 16:08:25 +0200 Message-Id: <1411049309-7976-15-git-send-email-jslaby@suse.cz> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1411049309-7976-1-git-send-email-jslaby@suse.cz> References: <1411049309-7976-1-git-send-email-jslaby@suse.cz> Sender: stable-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: stable@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: patch@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Roger Quadros This patch has been added to the 3.12 stable tree. If you have any objections, please let us know. =============== commit 40ddbf5069bd4e11447c0088fc75318e0aac53f0 upstream. commit 65b97cf6b8de introduced in v3.7 caused a regression by using a reversed CS_MASK thus causing omap_calculate_ecc to always fail. As the NAND base driver never checks for .calculate()'s return value, the zeroed ECC values are used as is without showing any error to the user. However, this won't work and the NAND device won't be guarded by any error code. Fix the issue by using the correct mask. Code was tested on omap3beagle using the following procedure - flash the primary bootloader (MLO) from the kernel to the first NAND partition using nandwrite. - boot the board from NAND. This utilizes OMAP ROM loader that relies on 1-bit Hamming code ECC. Fixes: 65b97cf6b8de (mtd: nand: omap2: handle nand on gpmc) Signed-off-by: Roger Quadros Signed-off-by: Tony Lindgren Signed-off-by: Jiri Slaby --- drivers/mtd/nand/omap2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c index 0332d0b2d73a..854662826272 100644 --- a/drivers/mtd/nand/omap2.c +++ b/drivers/mtd/nand/omap2.c @@ -948,7 +948,7 @@ static int omap_calculate_ecc(struct mtd_info *mtd, const u_char *dat, u32 val; val = readl(info->reg.gpmc_ecc_config); - if (((val >> ECC_CONFIG_CS_SHIFT) & ~CS_MASK) != info->gpmc_cs) + if (((val >> ECC_CONFIG_CS_SHIFT) & CS_MASK) != info->gpmc_cs) return -EINVAL; /* read ecc result */