From patchwork Sun Feb 19 11:48:37 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hou Tao X-Patchwork-Id: 142055 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 03D07B6EEC for ; Mon, 20 Feb 2012 00:46:21 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 758C128078; Sun, 19 Feb 2012 14:46:18 +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 6TJSlwdk8NyF; Sun, 19 Feb 2012 14:46:18 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 485072807B; Sun, 19 Feb 2012 14:46:16 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DE84E2807B for ; Sun, 19 Feb 2012 12:49:10 +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 RVYkAxZAJDUr for ; Sun, 19 Feb 2012 12:49:10 +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-iy0-f172.google.com (mail-iy0-f172.google.com [209.85.210.172]) by theia.denx.de (Postfix) with ESMTPS id 1A97F28078 for ; Sun, 19 Feb 2012 12:49:08 +0100 (CET) Received: by iagf6 with SMTP id f6so6441015iag.3 for ; Sun, 19 Feb 2012 03:49:05 -0800 (PST) Received-SPF: pass (google.com: domain of hotforest@gmail.com designates 10.50.149.162 as permitted sender) client-ip=10.50.149.162; Authentication-Results: mr.google.com; spf=pass (google.com: domain of hotforest@gmail.com designates 10.50.149.162 as permitted sender) smtp.mail=hotforest@gmail.com; dkim=pass header.i=hotforest@gmail.com Received: from mr.google.com ([10.50.149.162]) by 10.50.149.162 with SMTP id ub2mr7053940igb.1.1329652145832 (num_hops = 1); Sun, 19 Feb 2012 03:49:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; bh=ZNsHc7uio9ZDuLlwlHOnIAbz9wonD3/7O2gmTq11Uqc=; b=b+jhUJ+DzoNcNlFy2eyIAEbf2l8vghwWmU+2nnwprhieSrxDENqhDAOrZ0LH9TcHwC VZmTnJmhA8T136Wpty30PWKW+J4VZkT3BpDI8No2MmhwBMr26eRYTXE4ycw+KdSHU0fJ p2PLcCyXsiDMBPaZDsit9Pdj3EjT/5xsQJlu4= Received: by 10.50.149.162 with SMTP id ub2mr5698823igb.1.1329652145794; Sun, 19 Feb 2012 03:49:05 -0800 (PST) Received: from localhost.localdomain ([115.199.193.233]) by mx.google.com with ESMTPS id ch2sm4079073igb.4.2012.02.19.03.49.02 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 19 Feb 2012 03:49:05 -0800 (PST) From: htbegin To: u-boot@lists.denx.de Date: Sun, 19 Feb 2012 19:48:37 +0800 Message-Id: <1329652117-14084-1-git-send-email-hotforest@gmail.com> X-Mailer: git-send-email 1.7.4.1 X-Mailman-Approved-At: Sun, 19 Feb 2012 14:46:14 +0100 Cc: htbegin , Stefan Roese Subject: [U-Boot] [PATCH] 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: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Without the fix, flash_write_cfibuffer will return timeout error instead of not-erased error when all bytes in the first word of a sector are 0xFF and other words are not. Signed-off-by: htbegin Cc: Stefan Roese --- drivers/mtd/cfi_flash.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) 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; 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)) ==