Skip to content

Commit 4261b50

Browse files
committed
eep5211: RAW EEPROM reading support
Add support for RAW EEPROM contents loading if it is requested by the caller. The RAW data loading assumes complete contents ignoring. So, in this mode, the loader will read maximum amount of data (16 KiB at the moment). As a side effect, read data may contain multiple repeated copies of the EEPROM due to the cyclic nature of the read operation. The change was runtime tested with AR5414 chip.
1 parent c26858b commit 4261b50

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

eep_5211.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -932,6 +932,11 @@ static bool eep_5211_load_eeprom(struct atheepmgr *aem, bool raw)
932932
int len = 0, addr;
933933
uint16_t *buf = aem->eep_buf;
934934

935+
if (raw) { /* Use max size for RAW loading */
936+
len = aem->eepmap->eep_buf_sz;
937+
goto data_read;
938+
}
939+
935940
/* RAW magic reading with subsequent swaping requirement check */
936941
if (!EEP_READ(AR5211_EEP_MAGIC, &magic)) {
937942
fprintf(stderr, "EEPROM magic read failed\n");
@@ -965,6 +970,7 @@ static bool eep_5211_load_eeprom(struct atheepmgr *aem, bool raw)
965970
len = AR5211_SIZE_DEF;
966971
}
967972

973+
data_read:
968974
/* Read to intermediated buffer */
969975
for (addr = 0; addr < len; ++addr, ++buf) {
970976
if (!EEP_READ(addr, buf)) {
@@ -975,6 +981,9 @@ static bool eep_5211_load_eeprom(struct atheepmgr *aem, bool raw)
975981

976982
aem->eep_len = addr;
977983

984+
if (raw) /* Earlier exit on RAW contents loading */
985+
return true;
986+
978987
memset(&emp->param, 0x00, sizeof(emp->param));
979988

980989
eep_5211_fill_init_data(aem);
@@ -1542,6 +1551,7 @@ static bool eep_5211_update_eeprom(struct atheepmgr *aem, int param,
15421551
const struct eepmap eepmap_5211 = {
15431552
.name = "5211",
15441553
.desc = "Legacy .11abg chips EEPROM map (AR5211/AR5212/AR5414/etc.)",
1554+
.features = EEPMAP_F_RAW_EEP,
15451555
.chip_regs = {
15461556
.srev = 0x4020,
15471557
},

0 commit comments

Comments
 (0)