From patchwork Sat Nov 5 01:55:16 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfgang Denk X-Patchwork-Id: 123778 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 5D311B6F86 for ; Sat, 5 Nov 2011 13:04:45 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5F75B298EB; Sat, 5 Nov 2011 03:01:22 +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 lFCVcqsQcDXq; Sat, 5 Nov 2011 03:01:22 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DF297298EF; Sat, 5 Nov 2011 02:57:35 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D6C0529602 for ; Sat, 5 Nov 2011 02:56:27 +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 mcck6Gs1O7AW for ; Sat, 5 Nov 2011 02:56:27 +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-out.m-online.net (mail-out.m-online.net [212.18.0.9]) by theia.denx.de (Postfix) with ESMTP id D77E129612 for ; Sat, 5 Nov 2011 02:56:09 +0100 (CET) Received: from frontend1.mail.m-online.net (unknown [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 2B2AF1C01D94; Sat, 5 Nov 2011 02:56:07 +0100 (CET) X-Auth-Info: 2K9kTnRSpiGRvkVtx9UgO9R3W2SdGW75HlKBs1JNMmo= Received: from diddl.denx.de (host-80-81-18-216.customer.m-online.net [80.81.18.216]) by smtp-auth.mnet-online.de (Postfix) with ESMTPA id 1C6801C0012D; Sat, 5 Nov 2011 02:56:07 +0100 (CET) Received: from gemini.denx.de (unknown [10.0.0.2]) by diddl.denx.de (Postfix) with ESMTP id C846EC913106; Sat, 5 Nov 2011 02:56:06 +0100 (CET) Received: by gemini.denx.de (Postfix, from userid 500) id 9C5B81893017; Sat, 5 Nov 2011 02:56:06 +0100 (CET) From: Wolfgang Denk To: u-boot@lists.denx.de Date: Sat, 5 Nov 2011 02:55:16 +0100 Message-Id: <1320458160-23136-13-git-send-email-wd@denx.de> X-Mailer: git-send-email 1.7.6.4 In-Reply-To: <1320458160-23136-1-git-send-email-wd@denx.de> References: <1320458160-23136-1-git-send-email-wd@denx.de> Cc: Josef Wagner Subject: [U-Boot] [PATCH 12/56] PM520: add missing enable_interrupts() X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 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 The code disabled interrupts in several locations, without re-enabling them again. Fix this. While we are at it, also fix a GCC 4.6 build warning: flash.c: In function 'flash_erase': flash.c:373:21: warning: variable 'last' set but not used [-Wunused-but-set-variable] Signed-off-by: Wolfgang Denk Cc: Josef Wagner --- board/pm520/flash.c | 17 ++++++++++++----- 1 files changed, 12 insertions(+), 5 deletions(-) diff --git a/board/pm520/flash.c b/board/pm520/flash.c index 64c8624..01dcd56 100644 --- a/board/pm520/flash.c +++ b/board/pm520/flash.c @@ -370,7 +370,7 @@ static unsigned char intel_sector_protected (flash_info_t *info, ushort sector) int flash_erase (flash_info_t *info, int s_first, int s_last) { int flag, prot, sect; - ulong type, start, last; + ulong type, start; int rcode = 0; if ((s_first < 0) || (s_first > s_last)) { @@ -404,7 +404,6 @@ int flash_erase (flash_info_t *info, int s_first, int s_last) } start = get_timer (0); - last = start; /* Disable interrupts which might cause a timeout here */ flag = disable_interrupts (); @@ -440,6 +439,10 @@ int flash_erase (flash_info_t *info, int s_first, int s_last) printf (" done\n"); } } + + if (flag) + enable_interrupts(); + return rcode; } @@ -543,6 +546,7 @@ static int write_data (flash_info_t *info, ulong dest, FPW data) ulong status; ulong start; int flag; + int rcode = 0; /* Check if Flash is (sufficiently) erased */ if ((*addr & data) != data) { @@ -561,14 +565,17 @@ static int write_data (flash_info_t *info, ulong dest, FPW data) /* wait while polling the status register */ while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) { if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) { - *addr = (FPW) 0x00FF00FF; /* restore read mode */ - return (1); + rcode = 1; + break; } } *addr = (FPW) 0x00FF00FF; /* restore read mode */ - return (0); + if (flag) + enable_interrupts(); + + return rcode; } void inline spin_wheel (void)