Skip to contentSkip to conversation

Sparklan WPEA-121N AR9382 168c:abcd

ath9k-devel Alex Hacker 1 participant 1 message Apr 12, 2011

lore
Share & tools
lore
#0 lore raw
Quoted 1 line · Adrian Chadd

Is there an easy way to get an EEPROM/OTP contents dump in ath9k?

For AR93xx you can try to use the following script:

#!/usr/bin/perl -w

my $debugPath = '/debug/ath9k/phy0';

sub RegGet($)
{
open(F,">$debugPath/regidx") or die("Unable to open $debugPath/regidx."); printf(F "0x%x\n",shift());
close(F);

  open(F,"$debugPath/regval") or die("Unable to open $debugPath/regval.");
  local $val = <F>;
  $val =~ s/\s+$//g;
  close(F);

return hex($val);
}

sub EepromRead($)
{
RegGet(0x2000 + ((shift()/2) << 2));
while ((RegGet(0x4084) & 0x50000) != 0) {}
return RegGet(0x4084);
}

for (local $addr = 0; $addr < 0x400; $addr += 2)
{
printf("\n%04x:",$addr) if ($addr%16 == 0);
local $val = EepromRead($addr);
printf(" %02x %02x",$val >> 8,$val & 0xff);
}
printf("\n");