From patchwork Mon Dec 14 15:45:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Brodkin X-Patchwork-Id: 556547 X-Patchwork-Delegate: trini@ti.com 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 DA95914030D for ; Tue, 15 Dec 2015 02:45:53 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4966C4BA78; Mon, 14 Dec 2015 16:45:52 +0100 (CET) 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 NzbWgJ-HMicJ; Mon, 14 Dec 2015 16:45:52 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8145C4BA63; Mon, 14 Dec 2015 16:45:51 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A261D4BA63 for ; Mon, 14 Dec 2015 16:45:47 +0100 (CET) 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 kZUjeb7pdXLJ for ; Mon, 14 Dec 2015 16:45:47 +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 smtprelay.synopsys.com (smtprelay.synopsys.com [198.182.47.9]) by theia.denx.de (Postfix) with ESMTPS id 4F2144BA48 for ; Mon, 14 Dec 2015 16:45:43 +0100 (CET) Received: from us02secmta1.synopsys.com (us02secmta1.synopsys.com [10.12.235.96]) by smtprelay.synopsys.com (Postfix) with ESMTP id 9B24224E1E9D; Mon, 14 Dec 2015 07:45:40 -0800 (PST) Received: from us02secmta1.internal.synopsys.com (us02secmta1.internal.synopsys.com [127.0.0.1]) by us02secmta1.internal.synopsys.com (Service) with ESMTP id 8A7B84E213; Mon, 14 Dec 2015 07:45:40 -0800 (PST) Received: from mailhost.synopsys.com (unknown [10.13.184.66]) by us02secmta1.internal.synopsys.com (Service) with ESMTP id 5D9DE4E202; Mon, 14 Dec 2015 07:45:40 -0800 (PST) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id 4D4763EB; Mon, 14 Dec 2015 07:45:40 -0800 (PST) Received: from abrodkin-e7440l.internal.synopsys.com (abrodkin-e7440l.internal.synopsys.com [10.121.3.16]) by mailhost.synopsys.com (Postfix) with ESMTP id 39E933E2; Mon, 14 Dec 2015 07:45:37 -0800 (PST) From: Alexey Brodkin To: u-boot@lists.denx.de Date: Mon, 14 Dec 2015 18:45:34 +0300 Message-Id: <1450107934-7362-1-git-send-email-abrodkin@synopsys.com> X-Mailer: git-send-email 2.4.3 Cc: Marek Vasut , Tom Rini , Alexey Brodkin Subject: [U-Boot] [PATCH] eeprom: fix eeprom write procedure X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" This fixes commit 1a37889b0ad084a740b4f785031d7ae9955d947b: ----------------------->8-------------------- eeprom: Pull out the RW loop Unify the code for doing read/write into single function, since the code for both the read and write is almost identical. This again trims down the code duplication. ----------------------->8-------------------- where the same one routine is utilized for both EEPROM writing and reading. The only difference was supposed to be a "read" flag which in both cases was set with 1 somehow. That lead to a missing delay in case of writing which lead to write failure (in my case no data was written). Signed-off-by: Alexey Brodkin Cc: Marek Vasut Cc: Simon Glass Cc: Tom Rini Cc: Heiko Schocher Acked-by: Marek Vasut --- common/cmd_eeprom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/cmd_eeprom.c b/common/cmd_eeprom.c index 6eab1ea..571240a 100644 --- a/common/cmd_eeprom.c +++ b/common/cmd_eeprom.c @@ -197,7 +197,7 @@ int eeprom_write(unsigned dev_addr, unsigned offset, * We must write the address again when changing pages * because the address counter only increments within a page. */ - ret = eeprom_rw(dev_addr, offset, buffer, cnt, 1); + ret = eeprom_rw(dev_addr, offset, buffer, cnt, 0); eeprom_write_enable(dev_addr, 0); return ret;