some code in linux rtl8139cp driver

Hi, I am reading the source code of rtl8139 network card in linux. there are some codes like this: static void eeprom_cmd(void __iomem *ee_addr, int cmd, int cmd_len) { int i;

/* Shift the command bits out. */ for (i = cmd_len - 1; i >= 0; i--) { int dataval = (cmd & (1

Reply to
leilei
Loading thread data ...

Did you get the data sheet of the controller chip?

--

Tauno Voipio
tauno voipio (at) iki fi
Reply to
Tauno Voipio

);

hi, I have the datasheet.but i can not any place intruduce how to opearte the EEPROM.

Reply to
leilei

It appears to me that it is clocking data out serialy, one bit at a time. I would guess that EE_ENB represents the chip select (EECS) line. dataval is a single data bit. EE_SHIFT_CLK probably represents the clock line (EESK). dataval likely aligns with the data input pin (EEDI) for the rtl8139. The first writeb puts the clock in a known state and also presents the data bit. The second writeb presents the data and toggles the clock line. The final writeb toggles the clock back with 0 for the data. That would be my best guess. Look up SPI data transfer.

Reply to
Anthony Fremont

Good - now you know how to manupulate the serial EEPROM control bits.

Next, get the data sheet of the EEPROM chip.

--

Tauno Voipio
tauno voipio (at) iki fi
Reply to
Tauno Voipio

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.