From patchwork Thu Dec 6 06:21:18 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vipin Kumar X-Patchwork-Id: 204133 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 06DA12C0199 for ; Thu, 6 Dec 2012 17:21:59 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8D71D4A195; Thu, 6 Dec 2012 07:21:55 +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 CFZywQt+Zzpy; Thu, 6 Dec 2012 07:21:55 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 714DE4A165; Thu, 6 Dec 2012 07:21:51 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 356DE4A17E for ; Thu, 6 Dec 2012 07:21:39 +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 tv58HKvbYO+u for ; Thu, 6 Dec 2012 07:21:38 +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 eu1sys200aog115.obsmtp.com (eu1sys200aog115.obsmtp.com [207.126.144.139]) by theia.denx.de (Postfix) with ESMTPS id 754854A163 for ; Thu, 6 Dec 2012 07:21:35 +0100 (CET) Received: from beta.dmz-ap.st.com ([138.198.100.35]) (using TLSv1) by eu1sys200aob115.postini.com ([207.126.147.11]) with SMTP ID DSNKUMA5bK++tYwqqUCsfgDbOF1Fp+Un3dd9@postini.com; Thu, 06 Dec 2012 06:21:37 UTC Received: from zeta.dmz-ap.st.com (ns6.st.com [138.198.234.13]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id B4724F1; Thu, 6 Dec 2012 06:13:18 +0000 (GMT) Received: from Webmail-ap.st.com (eapex1hubcas3.st.com [10.80.176.67]) by zeta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 1555CAA4; Thu, 6 Dec 2012 06:21:30 +0000 (GMT) Received: from localhost (10.199.82.27) by Webmail-ap.st.com (10.80.176.7) with Microsoft SMTP Server (TLS) id 8.3.245.1; Thu, 6 Dec 2012 14:21:29 +0800 From: Vipin Kumar To: , , Date: Thu, 6 Dec 2012 11:51:18 +0530 Message-ID: X-Mailer: git-send-email 1.8.0 In-Reply-To: References: MIME-Version: 1.0 Cc: spear-devel@list.st.com Subject: [U-Boot] [PATCH resend 1/7] mtd/st_smi: Clear error flags while initiating a fresh 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 SMI controller reports an error when the code tries to write on the flash area with Write Enable command not issued or the bank has come out of the write mode. This error is reported even with a fresh write once the ERF1 or ERF2 is set. Clear these flags while initiating a fresh write Signed-off-by: Vipin Kumar --- drivers/mtd/st_smi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/mtd/st_smi.c b/drivers/mtd/st_smi.c index 7507e5d..fad4420 100644 --- a/drivers/mtd/st_smi.c +++ b/drivers/mtd/st_smi.c @@ -392,6 +392,8 @@ static int smi_write(unsigned int *src_addr, unsigned int *dst_addr, return -1; } + writel(readl(&smicntl->smi_sr) & ~(ERF1 | ERF2), &smicntl->smi_sr); + if (smi_wait_till_ready(banknum, CONFIG_SYS_FLASH_WRITE_TOUT)) return -EBUSY;