]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
eeprom: fix eeprom write procedure
authorAlexey Brodkin <Alexey.Brodkin@synopsys.com>
Mon, 14 Dec 2015 15:45:34 +0000 (18:45 +0300)
committerTom Rini <trini@konsulko.com>
Wed, 16 Dec 2015 15:31:31 +0000 (10:31 -0500)
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 <abrodkin@synopsys.com>
Acked-by: Marek Vasut <marex@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Heiko Schocher <hs@denx.de>
common/cmd_eeprom.c

index 6eab1ea083158907173719a4298bb915c1a1b353..571240a99bc011da7b4cc9f05de32f2c82eb59a8 100644 (file)
@@ -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.
         */
         * 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;
 
        eeprom_write_enable(dev_addr, 0);
        return ret;