Skip to contentSkip to conversation

rt2x00: EEPROM 93Cx6

PATCH In review Ivo van Doorn 3 participants 10 messages Dec 3, 2006 – Dec 13, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 4/26 rt2x00: EEPROM 93Cx6

rt2400pci, rt2500pci and rt61pci share exactly the same code for the eeprom reading. The only difference is that rt61pci has a slightly different register reading approach. In any case we have a lot of duplicate code. Create a new module eeprom_93cx6 inside the rt2x00 folder and make rt2x00 use that.
As a bonus the entire eeprom is read into an array to optimize eeprom usage. This also enables dummy eeprom writing where the temporary buffer can be manipulated by the user without permanently harming the eeprom. This feature should have been enabled through ethtool, but 3 days after this patch ethtool was removed from d80211. This feature will be used when debugfs has been implemented.

Signed-off-by Ivo van Doorn <[email protected]>

---

http://www.mendiosus.nl/rt2x00/04_eeprom.diff

#1 lore raw
Quoted 6 lines · Ivo van Doorn

rt2400pci, rt2500pci and rt61pci share exactly the same code for the eeprom reading. The only difference is that rt61pci has a slightly different register reading approach. In any case we have a lot of duplicate code. Create a new module eeprom_93cx6 inside the rt2x00 folder and make rt2x00 use that.

Interesting. adm8211 has code to read 93C66 and 93C46 eeproms, and it looks similar, albeit smaller and simpler, to your 93cx6 reading code. However, it looks like your new eeprom reading code is general enough for adm8211 to use too. I'll have to try it..

-Michael Wu

#2 lore raw
Quoted 11 lines · Michael Wu
Quoted 6 lines · Ivo van Doorn

rt2400pci, rt2500pci and rt61pci share exactly the same code for the eeprom reading. The only difference is that rt61pci has a slightly different register reading approach. In any case we have a lot of duplicate code. Create a new module eeprom_93cx6 inside the rt2x00 folder and make rt2x00 use that.

Interesting. adm8211 has code to read 93C66 and 93C46 eeproms, and it looks similar, albeit smaller and simpler, to your 93cx6 reading code. However, it looks like your new eeprom reading code is general enough for adm8211 to use too. I'll have to try it..

Good to hear, I'll check it out as well.
If they are indeed similar the eeprom_93cx6 could be moved to a more general location as well so the module can be shared. :)

Ivo

#3 lore raw
In reply to Michael Wu
Quoted 11 lines · Michael Wu
Quoted 6 lines · Ivo van Doorn

rt2400pci, rt2500pci and rt61pci share exactly the same code for the eeprom reading. The only difference is that rt61pci has a slightly different register reading approach. In any case we have a lot of duplicate code. Create a new module eeprom_93cx6 inside the rt2x00 folder and make rt2x00 use that.

Interesting. adm8211 has code to read 93C66 and 93C46 eeproms, and it looks similar, albeit smaller and simpler, to your 93cx6 reading code. However, it looks like your new eeprom reading code is general enough for adm8211 to use too. I'll have to try it..

I have checked the adm80211 code as well, it seems to behave quite the same, with the most notable difference the fact that adm80211 writes the READ_OPCODE and the word index within a single command, while in eeprom_93cx6 this is split into 2 seperate write commands.
I have not yet tested the exact impact for rt2x00 devices when they would combine the write commands, but if that has no impact (or the adm80211 suffers no impact when the write commands are being split) then rt2x00 and adm80211 could indeed share the eeprom_93cx6 module.
If eeprom_93cx6 is moved to the /lib folder of the kernel, should it be approved by a different maintainer first?

Ivo

#4 lore raw
Quoted 8 lines · Ivo van Doorn

I have checked the adm80211 code as well, it seems to behave quite the same, with the most notable difference the fact that adm80211 writes the READ_OPCODE and the word index within a single command, while in eeprom_93cx6 this is split into 2 seperate write commands.
I have not yet tested the exact impact for rt2x00 devices when they would combine the write commands, but if that has no impact (or the adm80211 suffers no impact when the write commands are being split) then rt2x00 and adm80211 could indeed share the eeprom_93cx6 module.

Hm, which way is the correct way? (is there a correct way?)

Quoted 3 lines

If eeprom_93cx6 is moved to the /lib folder of the kernel, should it be approved by a different maintainer first?

I don't think so, but I'm not sure. BTW, I think there can actually be another user of this code. Take a look at drivers/scsi/aic7xxx/aic7xxx_93cx6.c

I'm not sure who the maintainer for this is. Should be okay to just have adm8211 and rt2x00 using eeprom_93cx6 for now, unless you have a spare aic7xxx supported device lying around. ;)

Thanks,
-Michael Wu

#5 lore raw

Hi

Quoted 9 lines
Quoted 8 lines

I have checked the adm80211 code as well, it seems to behave quite the same, with the most notable difference the fact that adm80211 writes the READ_OPCODE and the word index within a single command, while in eeprom_93cx6 this is split into 2 seperate write commands.
I have not yet tested the exact impact for rt2x00 devices when they would combine the write commands, but if that has no impact (or the adm80211 suffers no impact when the write commands are being split) then rt2x00 and adm80211 could indeed share the eeprom_93cx6 module.

Hm, which way is the correct way? (is there a correct way?)

I have tested rt2x00 with combining the read command and word index writing, and it is working perfectly.

Quoted 10 lines
Quoted 3 lines

If eeprom_93cx6 is moved to the /lib folder of the kernel, should it be approved by a different maintainer first?

I don't think so, but I'm not sure. BTW, I think there can actually be another
user of this code. Take a look at drivers/scsi/aic7xxx/aic7xxx_93cx6.c

I'm not sure who the maintainer for this is. Should be okay to just have adm8211 and rt2x00 using eeprom_93cx6 for now, unless you have a spare aic7xxx supported device lying around. ;)

Nope, don't have that device. I'll create a patch that will place the eeprom module in the /lib folder. I'll send that to the list as soon as possible.

Ivo

#6 lore raw
Quoted 2 lines · Ivo Van Doorn

Nope, don't have that device. I'll create a patch that will place the eeprom module in the /lib folder. I'll send that to the list as soon as possible.

Hmm, I wonder if this will be of help for me trying to read/write a 93c46 connected to an exar uart (jsm driver). So far I was trying to bit bang the IO from user space through the PCI registers, but having a proper support in the driver would probably work better (so far I didn't get it to work although I haven't tried very hard yet).

--
Len Sorensen

#7 lore raw
Quoted 9 lines · Lennart Sorensen
Quoted 2 lines · Ivo Van Doorn

Nope, don't have that device. I'll create a patch that will place the eeprom module in the /lib folder. I'll send that to the list as soon as possible.

Hmm, I wonder if this will be of help for me trying to read/write a 93c46 connected to an exar uart (jsm driver). So far I was trying to bit bang the IO from user space through the PCI registers, but having a proper support in the driver would probably work better (so far I didn't get it to work although I haven't tried very hard yet).

Do you need to actually write data to the eeprom chip? Currently the module does not support writing to the eeprom, this is something I could add (The original Ralink code, where this module is based on also contains the code to write to the EEPROM).

Ivo

#8 lore raw
Quoted 4 lines · Ivo van Doorn

Do you need to actually write data to the eeprom chip? Currently the module does not support writing to the eeprom, this is something I could add (The original Ralink code, where this module is based on also contains the code to write to the EEPROM).

I am going to use it to write the custom pci vendor ID to the eeprom, so yes I intend to write to it. The code appears as if it has the ability to write to the eeprom but I didn't look at all of it carefully yet. I don't actually have any need to read it back, although I intend to do so to verify the contents.

--
Len Sorensen

#9 lore raw
Quoted 11 lines · Lennart Sorensen
Quoted 4 lines · Ivo van Doorn

Do you need to actually write data to the eeprom chip? Currently the module does not support writing to the eeprom, this is something I could add (The original Ralink code, where this module is based on also contains the code to write to the EEPROM).

I am going to use it to write the custom pci vendor ID to the eeprom, so yes I intend to write to it. The code appears as if it has the ability to write to the eeprom but I didn't look at all of it carefully yet. I don't actually have any need to read it back, although I intend to do so to verify the contents.

Currently the module does not contain any code to actually write to the eeprom. I'll create a patch to add support for the writing.