summaryrefslogtreecommitdiff
path: root/board/isee/common/igep_eeprom.c
diff options
context:
space:
mode:
Diffstat (limited to 'board/isee/common/igep_eeprom.c')
-rw-r--r--board/isee/common/igep_eeprom.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/board/isee/common/igep_eeprom.c b/board/isee/common/igep_eeprom.c
index ff2e4e2..98953bc 100644
--- a/board/isee/common/igep_eeprom.c
+++ b/board/isee/common/igep_eeprom.c
@@ -5,7 +5,7 @@
*
* Author: Jose Miguel Sanchez Sanabria <jsanabria@iseebcn.com>
*
- * SPDX-License-Identifier: GPL-2.0+
+ * SPDX-License-Identifier: GPL-2.0+
*/
#include <common.h>
@@ -13,7 +13,7 @@
#include <asm/arch/sys_proto.h>
-int eeprom_write_setup (uint8_t s_addr, const char* data, u32 size)
+int eeprom_write_setup (uint16_t s_addr, const char* data, u32 size)
{
u32 i;
u32 remain = size % 32;
@@ -22,18 +22,18 @@ int eeprom_write_setup (uint8_t s_addr, const char* data, u32 size)
if(i2c_write(CONFIG_SYS_I2C_EEPROM_ADDR, s_addr + (i*32), 2, (uint8_t*) data + (i*32), 32)){
return -1;
}
- udelay(5000);
+ mdelay(10);
}
if(remain > 0){
if(i2c_write(CONFIG_SYS_I2C_EEPROM_ADDR, s_addr + (i*32), 2, (uint8_t*) data + (i*32), remain))
return -1;
else
- udelay(5000);
+ mdelay(10);
}
return 0;
}
-int eeprom_read_setup (uint8_t s_addr, char* data, u32 size)
+int eeprom_read_setup (uint16_t s_addr, char* data, u32 size)
{
u32 i;
u32 remain = size % 32;
@@ -53,10 +53,19 @@ int check_eeprom (void)
{
i2c_set_bus_num(CONFIG_SYS_I2C_EEPROM_BUS);
/* Check if baseboard eeprom is available */
- if (i2c_probe(CONFIG_SYS_I2C_EEPROM_ADDR)) {
- printf("Could not probe the EEPROM at 0x%x\n",
- CONFIG_SYS_I2C_EEPROM_ADDR);
- return -1;
- }
- return 0;
+ if (i2c_probe(CONFIG_SYS_I2C_EEPROM_ADDR)) {
+ printf("Could not probe the EEPROM at 0x%x\n",
+ CONFIG_SYS_I2C_EEPROM_ADDR);
+ return -1;
+ }
+ return 0;
}
+
+unsigned int parse_char(char c)
+{
+ if ('0' <= c && c <= '9') return c - '0';
+ if ('a' <= c && c <= 'f') return 10 + c - 'a';
+ if ('A' <= c && c <= 'F') return 10 + c - 'A';
+
+ return 0;
+} \ No newline at end of file