]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
eeprom: Make eeprom_write_enable() weak
authorMarek Vasut <marex@denx.de>
Tue, 10 Nov 2015 19:53:25 +0000 (20:53 +0100)
committerTom Rini <trini@konsulko.com>
Sun, 22 Nov 2015 02:50:23 +0000 (21:50 -0500)
Make this function weak and implement it's weak implementation
so that the boards can just reimplement it. This zaps the horrid
CONFIG_SYS_EEPROM_WREN macro.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Heiko Schocher <hs@denx.de>
Reviewed-by: Heiko Schocher <hs@denx.de>
common/cmd_eeprom.c

index 59799939123b769da1dffeb3def7202b3aa09fa9..040ab5ffd9e4e8b54bad923e44dacec8ef757634 100644 (file)
 #endif
 #endif
 
-#if defined(CONFIG_SYS_EEPROM_WREN)
-extern int eeprom_write_enable (unsigned dev_addr, int state);
-#endif
+__weak int eeprom_write_enable(unsigned dev_addr, int state)
+{
+       return 0;
+}
 
 void eeprom_init(void)
 {
@@ -163,9 +164,8 @@ int eeprom_write (unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cn
        int rcode = 0;
        uchar addr[3];
 
-#if defined(CONFIG_SYS_EEPROM_WREN)
-       eeprom_write_enable (dev_addr,1);
-#endif
+       eeprom_write_enable(dev_addr, 1);
+
        /*
         * Write data until done or would cross a write page boundary.
         * We must write the address again when changing pages
@@ -215,9 +215,9 @@ int eeprom_write (unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cn
                udelay(CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS * 1000);
 #endif
        }
-#if defined(CONFIG_SYS_EEPROM_WREN)
-       eeprom_write_enable (dev_addr,0);
-#endif
+
+       eeprom_write_enable(dev_addr, 0);
+
        return rcode;
 }