Fix the machine-id of the Cogent csb637 board
[platform/kernel/u-boot.git] / common / cmd_eeprom.c
index 2d4c9f6..d15a412 100644 (file)
  * FRAM devices read and write data at bus speed. In particular, there is no
  * write delay. Also, there is no limit imposed on the numer of bytes that can
  * be transferred with a single read or write.
- * 
+ *
  * Use the following configuration options to ensure no unneeded performance
  * degradation (typical for EEPROM) is incured for FRAM memory:
- * 
+ *
  * #define CFG_I2C_FRAM
  * #undef CFG_EEPROM_PAGE_WRITE_DELAY_MS
  *
@@ -49,6 +49,9 @@ extern int  eeprom_read  (unsigned dev_addr, unsigned offset,
                          uchar *buffer, unsigned cnt);
 extern int  eeprom_write (unsigned dev_addr, unsigned offset,
                          uchar *buffer, unsigned cnt);
+#if defined(CFG_EEPROM_WREN)
+extern int eeprom_write_enable (unsigned dev_addr, int state);
+#endif
 #endif
 
 
@@ -214,6 +217,9 @@ int eeprom_write (unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cn
        int     i;
 #endif
 
+#if defined(CFG_EEPROM_WREN)
+       eeprom_write_enable (dev_addr,1);
+#endif
        /* Write data until done or would cross a write page boundary.
         * We must write the address again when changing pages
         * because the address counter only increments within a page.
@@ -367,6 +373,9 @@ int eeprom_write (unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cn
                udelay(CFG_EEPROM_PAGE_WRITE_DELAY_MS * 1000);
 #endif
        }
+#if defined(CFG_EEPROM_WREN)
+       eeprom_write_enable (dev_addr,0);
+#endif
        return rcode;
 }