* Copyright (C) 2014,2016 david_yang <david_yang@accton.com>
*/
-#include <command.h>
-#include <dm.h>
-#include <i2c.h>
-#include <i2c_eeprom.h>
-#include <env.h>
-#include <init.h>
-#include <net.h>
-#include <asm/global_data.h>
-#include <linux/ctype.h>
-#include <u-boot/crc.h>
-
+#include <stdio.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <zlib.h> /* For crc32 routine */
+
+#include "linux-compat.h"
#include "tlv_eeprom.h"
/* File scope function prototypes */
*/
int read_tlv_eeprom(void *eeprom, int offset, int len, int dev_num)
{
- struct udevice *dev;
-
- if (dev_num >= MAX_TLV_DEVICES)
- return -EINVAL;
-
- dev = find_tlv_device_by_index(dev_num);
- if (!dev)
- return -ENODEV;
-
- return i2c_eeprom_read(dev, offset, eeprom, len);
+ (void) dev_num;
+ return eeprom_block_read(offset, eeprom, len);
}
/**
*/
int write_tlv_eeprom(void *eeprom, int len, int dev)
{
- if (!(gd->flags & GD_FLG_RELOC))
- return -ENODEV;
- if (!tlv_devices[dev])
- return -ENODEV;
-
- return i2c_eeprom_write(tlv_devices[dev], 0, eeprom, len);
+ (void) dev;
+ return eeprom_block_write(0, eeprom, len);
}
int read_tlvinfo_tlv_eeprom(void *eeprom, struct tlvinfo_header **hdr,
#include <linux/errno.h>
+#include "linux-compat.h"
+
/*
* The Definition of the TlvInfo EEPROM format can be found at onie.org or
* github.com/onie
int read_eeprom(int devnum, u8 *eeprom);
void show_tlv_code_list(void);
+/* Callbacks in main.c */
+int eeprom_block_read(int offset, uint8_t *buf, int size);
+int eeprom_block_write(int offset, const uint8_t *buf, int size);
+
#endif /* __TLV_EEPROM_H_ */