Skip to content

Commit 9286e6d

Browse files
committed
eep5416/9285/9287: RAW EEPROM reading support
Add support for RAW EEPROM contents loading if it is requested by the caller. It assumes complete contents ignoring, including I/O byteswapping check bypassing. The change was runtime tested with AR9280 based card (eep5416 format), and with AR9285 based card (eep9285 aka eeprom 4k format). eep9287 format code was compile tested only, but due to its similarity to the eep5416 and eep9285 formats, it should work normally too.
1 parent df046ab commit 9286e6d

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

eep_5416.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ static bool eep_5416_load_eeprom(struct atheepmgr *aem, bool raw)
4646
uint16_t *buf = aem->eep_buf;
4747
int addr;
4848

49-
/* Check byteswaping requirements */
50-
if (!AR5416_TOGGLE_BYTESWAP(5416))
49+
/* Check byteswaping requirements for non-RAW operation */
50+
if (!raw && !AR5416_TOGGLE_BYTESWAP(5416))
5151
return false;
5252

5353
/* Read to the intermediate buffer */
@@ -59,6 +59,9 @@ static bool eep_5416_load_eeprom(struct atheepmgr *aem, bool raw)
5959
}
6060
aem->eep_len = addr;
6161

62+
if (raw) /* Earlier exit on RAW contents loading */
63+
return true;
64+
6265
/* Copy from buffer to the Init data */
6366
for (addr = 0; addr < AR5416_DATA_START_LOC; ++addr)
6467
eep_init[addr] = buf[addr];
@@ -602,6 +605,7 @@ static bool eep_5416_update_eeprom(struct atheepmgr *aem, int param,
602605
const struct eepmap eepmap_5416 = {
603606
.name = "5416",
604607
.desc = "Default EEPROM map for earlier .11n chips (AR5416/AR9160/AR92xx/etc.)",
608+
.features = EEPMAP_F_RAW_EEP,
605609
.chip_regs = {
606610
.srev = 0x4020,
607611
},

eep_9285.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ static bool eep_9285_load_eeprom(struct atheepmgr *aem, bool raw)
4646
uint16_t *buf = aem->eep_buf;
4747
int addr;
4848

49-
/* Check byteswaping requirements */
50-
if (!AR5416_TOGGLE_BYTESWAP(9285))
49+
/* Check byteswaping requirements for non-RAW operation */
50+
if (!raw && !AR5416_TOGGLE_BYTESWAP(9285))
5151
return false;
5252

5353
/* Read to the intermediate buffer */
@@ -59,6 +59,9 @@ static bool eep_9285_load_eeprom(struct atheepmgr *aem, bool raw)
5959
}
6060
aem->eep_len = addr;
6161

62+
if (raw) /* Earlier exit on RAW contents loading */
63+
return true;
64+
6265
/* Copy from buffer to the Init data */
6366
for (addr = 0; addr < AR9285_DATA_START_LOC; ++addr)
6467
eep_init[addr] = buf[addr];
@@ -330,6 +333,7 @@ static void eep_9285_dump_power_info(struct atheepmgr *aem)
330333
const struct eepmap eepmap_9285 = {
331334
.name = "9285",
332335
.desc = "AR9285 chip EEPROM map",
336+
.features = EEPMAP_F_RAW_EEP,
333337
.chip_regs = {
334338
.srev = 0x4020,
335339
},

eep_9287.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ static bool eep_9287_load_eeprom(struct atheepmgr *aem, bool raw)
4646
uint16_t *buf = aem->eep_buf;
4747
int addr;
4848

49-
/* Check byteswaping requirements */
50-
if (!AR5416_TOGGLE_BYTESWAP(9287))
49+
/* Check byteswaping requirements for non-RAW operation */
50+
if (!raw && !AR5416_TOGGLE_BYTESWAP(9287))
5151
return false;
5252

5353
/* Read to the intermediate buffer */
@@ -59,6 +59,9 @@ static bool eep_9287_load_eeprom(struct atheepmgr *aem, bool raw)
5959
}
6060
aem->eep_len = addr;
6161

62+
if (raw) /* Earlier exit on RAW contents loading */
63+
return true;
64+
6265
/* Copy from buffer to the Init data */
6366
for (addr = 0; addr < AR9287_DATA_START_LOC; ++addr)
6467
eep_init[addr] = buf[addr];
@@ -407,6 +410,7 @@ static void eep_9287_dump_power_info(struct atheepmgr *aem)
407410
const struct eepmap eepmap_9287 = {
408411
.name = "9287",
409412
.desc = "AR9287 chip EEPROM map",
413+
.features = EEPMAP_F_RAW_EEP,
410414
.chip_regs = {
411415
.srev = 0x4020,
412416
},

0 commit comments

Comments
 (0)