lynxis / iwleeprom

Automatically exported from code.google.com/p/iwleeprom
2 stars 1 forks source link

eeprom writing not really working with ar9380 minipcie card #16

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. dump eeprom file with iwleeprom
2. modify the regdomain in the dump from 64 to 37 with an hex editor
3. correct crc of the dump using iwleeprom internal crc calculator (with -s 
switch) to have a 100% valid eeprom dump
4. write back the dump to real eeprom using -i switch, iwleeprom says EEPROM 
has been written, but in reality nothing changed in the real eeprom

What is the expected output? What do you see instead?
the real eeprom is not modified

What version of the product are you using? On what operating system?
iwleeprom r43 atheros branch in ubuntu 14.04

Please provide any additional information below.

ubuntu@ubuntu:~/atheros$ iwleeprom -s
Supported devices detected: 
  [1] 0000:07:00.0 [RW] AR9300 Wireless Adapter (PCI-E) (168c:0030, 106b:009a)
Select device [1-1] (or 0 to quit): 1
Using device 0000:07:00.0 [RW] AR9300 Wireless Adapter (PCI-E) 
IO driver: ath9300
HW: AR9300 (PCI-E) rev 0003
RF: integrated
Trying EEPROM access...
OTP address out of range: 0fff
OTP address out of range: 1001
ath9300_eeprom_check_header 00000000  @0fff r=0
Filling ath9300 EEPROM... DONE
OTP address out of range: 0401
ath9300_eeprom_check_header 00650000  @03ff r=1
AR9300 device NVM type: EEPROM  (data block @03ff)
Found block at 3ff: code=3 ref=5 length=635 major=2 minor=12 (RAW: 0cb22765)
Calculating EEPROM CRC...
CRC (stored): c510
CRC (eval)  : c510
compression : block
ath9300 short eeprom base: 383 (0x017f) size: 641

==== BASE ====
Version     : 02
Template    : 05
Cust data   : C8611110C76DDV3AB
MAC address : e4:ce:8f:50:a1:01
Reg. domain : 0064 001f
Tx mask     : 0111
Rx mask     : 0111
Capabilities: 03
       Bands: 5GHz 2.4GHz
       HT 2G: HT20 HT40
       HT 5G: HT20 HT40
Misc flags  : 00
Big endian  :  0

==== MISC ====
rfSilent       : 00
BT options     : 00
deviceCap      : 00
deviceType     : 05
pwrTableOffset : 00
tuning params  : 00 00
featureEnable  : 0d
miscConfig     : 14
txrxgain       : 00
swreg          : 00000000

==== GPIO ====
EEPROM WE      : 06
WLAN disable   : 00
WLAN LED       : 08
Rx band select : ff

ubuntu@ubuntu:~/atheros$ iwleeprom -n -i dump9300mod -F ath9300 -s
Forced driver name: ath9300
Device-less operation...
 Using IO driver (forced): ath9300
  byte order: LITTLE ENDIAN
Trying EEPROM access...
OTP address out of range: 0fff
OTP address out of range: 1001
ath9300_eeprom_check_header 00000000  @0fff r=0
Filling ath9300 EEPROM... DONE
OTP address out of range: 0401
ath9300_eeprom_check_header 00650000  @03ff r=1
AR9300 device NVM type: EEPROM  (data block @03ff)
Found block at 3ff: code=3 ref=5 length=635 major=2 minor=12 (RAW: 0cb22765)
Calculating EEPROM CRC...
CRC (stored): c4e3
CRC (eval)  : c4e3
compression : block
ath9300 short eeprom base: 383 (0x017f) size: 641

==== BASE ====
Version     : 02
Template    : 05
Cust data   : C8611110C76DDV3AB
MAC address : e4:ce:8f:50:a1:01
Reg. domain : 0037 001f
Tx mask     : 0111
Rx mask     : 0111
Capabilities: 03
       Bands: 5GHz 2.4GHz
       HT 2G: HT20 HT40
       HT 5G: HT20 HT40
Misc flags  : 00
Big endian  :  0

==== MISC ====
rfSilent       : 00
BT options     : 00
deviceCap      : 00
deviceType     : 05
pwrTableOffset : 00
tuning params  : 00 00
featureEnable  : 0d
miscConfig     : 14
txrxgain       : 00
swreg          : 00000000

==== GPIO ====
EEPROM WE      : 06
WLAN disable   : 00
WLAN LED       : 08
Rx band select : ff

ubuntu@ubuntu:~/atheros$ iwleeprom -i dump9300mod
Supported devices detected: 
  [1] 0000:07:00.0 [RW] AR9300 Wireless Adapter (PCI-E) (168c:0030, 106b:009a)
Select device [1-1] (or 0 to quit): 1
Using device 0000:07:00.0 [RW] AR9300 Wireless Adapter (PCI-E) 
IO driver: ath9300
HW: AR9300 (PCI-E) rev 0003
RF: integrated
Trying EEPROM access...
OTP address out of range: 0fff
OTP address out of range: 1001
ath9300_eeprom_check_header 00000000  @0fff r=0
Filling ath9300 EEPROM... DONE
OTP address out of range: 0401
ath9300_eeprom_check_header 00650000  @03ff r=1
AR9300 device NVM type: EEPROM  (data block @03ff)
Found block at 3ff: code=3 ref=5 length=635 major=2 minor=12 (RAW: 0cb22765)
Calculating EEPROM CRC...
CRC (stored): c510
CRC (eval)  : c510
compression : block
ath9300 short eeprom base: 383 (0x017f) size: 641
About to write device EEPROM, press 'Y' if you are sure... Y
Writing data to EEPROM...
  '.' = match, 'x' = write
Dump file byte order: LITTLE ENDIAN
0000 [................................................................]
0080 [................................................................]
0100 [...............................................................x]
0180 [x...............................................................]
0200 [................................................................]
0280 [................................................................]
0300 [................................................................]
0380 [...............................................x................]

EEPROM has been written from 'dump9300mod'

>but in reality nothing changed...

Original issue reported on code.google.com by bigboo3...@gmail.com on 13 May 2014 at 3:07

GoogleCodeExporter commented 9 years ago
dump9300 original dump
dump9300 modded dump using ghex

Original comment by bigboo3...@gmail.com on 13 May 2014 at 3:12

Attachments:

GoogleCodeExporter commented 9 years ago
Same from here :
Dumped Rom
Changed Regdomain
Fix CRC
Used iwl to write rom
iwl reported no error but rom did not changed

Original comment by pana...@gmail.com on 29 May 2014 at 9:06

GoogleCodeExporter commented 9 years ago

Original comment by pana...@gmail.com on 29 May 2014 at 9:08

Attachments:

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
CRC stays the same also for me.

iwleeprom -D1 -d 0000:03:00.0 -i etsic0x65.bin
debug level: 1
Using device 0000:03:00.0 [RW] AR9462 Wireless Adapter (PCI-E)
IO driver: ath9300
Supported ops:  read write parse
address: f7c00000
HW: AR9462 (PCI) rev 0002
RF: integrated
Trying EEPROM access...
OTP address out of range: 0fff
OTP address out of range: 1001
ath9300_eeprom_check_header 00000000  @0fff r=0
Filling ath9300 EEPROM... DONE
OTP address out of range: 0401
ath9300_eeprom_check_header 00000000  @03ff r=0
ath9300_eeprom_check_header 00000000  @01ff r=0
Trying OTP access...
 DONE
ath9300_eeprom_check_header 0c642d93  @03ff r=1
AR9300 device NVM type: OTP  (data block @03ff)
Found block at 3ff: code=3 ref=4 length=729 major=3 minor=12 (RAW: 0c932d64)
Calculating EEPROM CRC...
CRC (stored): acd8
CRC (eval)  : acd8
compression : block
ath9300 short eeprom base: 289 (0x0121) size: 735

Would be nice to if someone can have a look at it.

Original comment by florian.nolden on 10 Nov 2014 at 2:51

GoogleCodeExporter commented 9 years ago
@florian.nolden

> AR9300 device NVM type: OTP  (data block @03ff)

In your case the EEPROM is not writable (OTP means One-Time Programmable). I'm 
no expert, but I don't think it's possible to fix it programmatically.

There is problem with iwleeprom silently ignoring any write-related commands if 
`eeprom_writable` flag is not set, while, IMHO, the expected behaviour is to 
raise an error:

Index: iwleeprom.c
===================================================================
--- iwleeprom.c (revision 44)
+++ iwleeprom.c (working copy)
@@ -608,11 +608,19 @@
        if (parse && dev.ops->eeprom_parse)
                dev.ops->eeprom_parse(&dev);

-       if (ifname && dev.ops->eeprom_writable)
-               eeprom_write(ifname);
+       if (ifname) {
+               if (dev.ops->eeprom_writable)
+                       eeprom_write(ifname);
+               else
+                       die("Read-only eeprom!\n");
+       }

-       if (patch11n && dev.ops->eeprom_writable)
-               dev.ops->eeprom_patch11n(&dev);
+       if (patch11n) {
+               if (dev.ops->eeprom_writable)
+                       dev.ops->eeprom_patch11n(&dev);
+               else
+                       die("Read-only eeprom!\n");
+       }

        if (parse && dev.ops->eeprom_parse && (ifname || patch11n)) {
                printf("\n\ndevice capabilities after eeprom writing:\n");

Original comment by al42...@gmail.com on 10 Feb 2015 at 12:59

GoogleCodeExporter commented 9 years ago
Thanks, for the clarification. 

I got the card from ebay. Is there a way known to figure out if a wifi card is 
OTP before buying it? 

My card was labeled as:
Lite-On WCBN611AH Half Size MINI PCI Express 
with Qualcomm Atheros AR9462 Wlan+Bluetooth 4.0+HS

But this card is OTP and disallows any host/ap wifi at 5 Ghz by default, maybe 
that helps atleast others.

Original comment by florian.nolden on 10 Feb 2015 at 2:04