|
|
@ -152,8 +152,7 @@ int testdram (void) |
|
|
|
int eeprom_write_enable (unsigned dev_addr, int state) { |
|
|
|
int eeprom_write_enable (unsigned dev_addr, int state) { |
|
|
|
if (CFG_I2C_EEPROM_ADDR != dev_addr) { |
|
|
|
if (CFG_I2C_EEPROM_ADDR != dev_addr) { |
|
|
|
return -1; |
|
|
|
return -1; |
|
|
|
} |
|
|
|
} else { |
|
|
|
else { |
|
|
|
|
|
|
|
switch (state) { |
|
|
|
switch (state) { |
|
|
|
case 1: |
|
|
|
case 1: |
|
|
|
/* Enable write access, clear bit GPIO_SINT2. */ |
|
|
|
/* Enable write access, clear bit GPIO_SINT2. */ |
|
|
@ -186,19 +185,16 @@ int do_eep_wren (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) |
|
|
|
state = eeprom_write_enable (CFG_I2C_EEPROM_ADDR, -1); |
|
|
|
state = eeprom_write_enable (CFG_I2C_EEPROM_ADDR, -1); |
|
|
|
if (state < 0) { |
|
|
|
if (state < 0) { |
|
|
|
puts ("Query of write access state failed.\n"); |
|
|
|
puts ("Query of write access state failed.\n"); |
|
|
|
} |
|
|
|
} else { |
|
|
|
else { |
|
|
|
|
|
|
|
printf ("Write access for device 0x%0x is %sabled.\n", |
|
|
|
printf ("Write access for device 0x%0x is %sabled.\n", |
|
|
|
CFG_I2C_EEPROM_ADDR, state ? "en" : "dis"); |
|
|
|
CFG_I2C_EEPROM_ADDR, state ? "en" : "dis"); |
|
|
|
state = 0; |
|
|
|
state = 0; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
else { |
|
|
|
|
|
|
|
if ('0' == argv[1][0]) { |
|
|
|
if ('0' == argv[1][0]) { |
|
|
|
/* Disable write access. */ |
|
|
|
/* Disable write access. */ |
|
|
|
state = eeprom_write_enable (CFG_I2C_EEPROM_ADDR, 0); |
|
|
|
state = eeprom_write_enable (CFG_I2C_EEPROM_ADDR, 0); |
|
|
|
} |
|
|
|
} else { |
|
|
|
else { |
|
|
|
|
|
|
|
/* Enable write access. */ |
|
|
|
/* Enable write access. */ |
|
|
|
state = eeprom_write_enable (CFG_I2C_EEPROM_ADDR, 1); |
|
|
|
state = eeprom_write_enable (CFG_I2C_EEPROM_ADDR, 1); |
|
|
|
} |
|
|
|
} |
|
|
|