From patchwork Thu Mar 15 15:33:58 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hou Tao X-Patchwork-Id: 147035 X-Patchwork-Delegate: sr@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 2B9C9B6F98 for ; Fri, 16 Mar 2012 02:34:12 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1E3E7280F9; Thu, 15 Mar 2012 16:34:09 +0100 (CET) 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 rgjqwwfM9XJf; Thu, 15 Mar 2012 16:34:08 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CD08D28102; Thu, 15 Mar 2012 16:34:05 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3ED3B28102 for ; Thu, 15 Mar 2012 16:34:03 +0100 (CET) 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 3+cFw47O5aeG for ; Thu, 15 Mar 2012 16:34:02 +0100 (CET) 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-ee0-f44.google.com (mail-ee0-f44.google.com [74.125.83.44]) by theia.denx.de (Postfix) with ESMTPS id 0B95E280F9 for ; Thu, 15 Mar 2012 16:34:00 +0100 (CET) Received: by eeke51 with SMTP id e51so1746506eek.3 for ; Thu, 15 Mar 2012 08:33:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=9LnoL3KdqckdeBeelEm4IZdF2Ai3tQ8qcgfZtVG17gI=; b=ghb6D6M+Ss20Id+pDGErr/Dwt+ix8x1JFbRzmR0f5PIVSrdCsc9eUkDPHxxxZUkl9T 5WaWXUxsAuovu0gKL+q+e1TRVJp2xr4XGtf0n8wG6WBNkMJ/54oXxltiwgHWzLogTHTW y1ryBoMO3ACUgPrCwuIVgpIX9Ufe4pmo9+nqubMmvwS1GBK6oAgAPKdLJDSmdQFBmgl+ Vr3OAo0cQaurhxo7ujV7KAQ27i1JIyEE9Gwth1M4NKVCARcEsQ1o3DEfwz72oghlfaN4 ngriR5ZuCZCrYx5Ql2zEQ1FOmjG5TeJw21sVADDcXVtXyH9HoXU0ILuY/7pjKYx1vOTA gNhQ== MIME-Version: 1.0 Received: by 10.50.214.36 with SMTP id nx4mr17704511igc.2.1331825638085; Thu, 15 Mar 2012 08:33:58 -0700 (PDT) Received: by 10.231.137.2 with HTTP; Thu, 15 Mar 2012 08:33:58 -0700 (PDT) In-Reply-To: <201203061551.25332.sr@denx.de> References: <1329652117-14084-1-git-send-email-hotforest@gmail.com> <201203061551.25332.sr@denx.de> Date: Thu, 15 Mar 2012 23:33:58 +0800 Message-ID: From: htbegin To: u-boot@lists.denx.de Cc: Stefan Roese Subject: [U-Boot] [PATCH v2] cfi: fix the incomplete erased status check in buffer write 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: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Without the fix, flash_write_cfibuffer will terminate the erased status check once an all-0xFF word has been found instead of continuing the erased status check utill the first non-0xFF word. Signed-off-by: Tao Hou Cc: Stefan Roese --- Changes for v2: - use my real name in the "Signed-off-by" line - rewrite the patch description --- drivers/mtd/cfi_flash.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) uchar write_cmd; @@ -898,7 +898,7 @@ static int flash_write_cfibuffer (flash_info_t * info, ulong dest, uchar * cp, cnt = len >> shift; - while ((cnt-- > 0) && (flag == 0)) { + while ((cnt-- > 0) && (flag == 1)) { switch (info->portwidth) { case FLASH_CFI_8BIT: flag = ((flash_read8(dst2) & flash_read8(src)) == diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 722c3fc..35294bc 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -873,7 +873,7 @@ static int flash_write_cfibuffer (flash_info_t * info, ulong dest, uchar * cp, void *src = cp; void *dst = (void *)dest; void *dst2 = dst; - int flag = 0; + int flag = 1; uint offset = 0; unsigned int shift;