12 return flex_i2c_write(adapter, 0x20000000, 0x50, addr, buf, len);
21 if (eeprom_write(adapter, addr, wbuf, len) == len) {
22 if (eeprom_lrc_read(adapter, addr, len, rbuf, retries) == 1)
31 static int eeprom_writeKey(
struct adapter *adapter,
u8 *
key,
u32 len)
43 wbuf[19] = calc_lrc(wbuf, 19);
44 return eeprom_lrc_write(adapter, 0x3e4, 20, wbuf, rbuf, 4);
47 static int eeprom_readKey(
struct adapter *adapter,
u8 *key,
u32 len)
54 if (eeprom_lrc_read(adapter, 0x3e4, 20, buf, 4) == 0)
61 static char eeprom_set_mac_addr(
struct adapter *adapter,
char type,
u8 *
mac)
82 tmp[7] = calc_lrc(tmp, 7);
84 if (eeprom_write(adapter, 0x3f8, tmp, 8) == 8)
97 static u8 calc_lrc(
u8 *buf,
int len)
101 for (i = 0; i < len; i++)
110 u8 chipaddr = 0x50 | ((addr >> 8) & 3);
111 for (i = 0; i <
retries; i++) {
113 addr & 0xff, buf, len);
121 u8 *buf,
u16 len,
int retries)
123 int ret = flexcop_eeprom_request(fc,
FC_READ, addr, buf, len, retries);
125 if (calc_lrc(buf, len - 1) != buf[len - 1])
137 if ((ret = flexcop_eeprom_lrc_read(fc,0x3f8,buf,8,4)) == 0) {
139 err(
"TODO: extended (EUI64) MAC addresses aren't "
140 "completely supported yet");