Skip to contentSkip to conversation

mac address inside eeprom.

DISCUSSION Andrea Gasparini 2 participants 3 messages Mar 25, 2011

lore
Share & tools
lore
#0 lore raw

Hi,
My system has an AT24 eeprom (drivers/misc/eeprom/at24.c), that contains the mac adress of my ethernet.
Is there a standard way to retrieve data from other devices, that should be used inside drivers?

I've already modified both at24.c and the ethernet driver to do so, but I'm wondering if there was already a better way.

Thanks, bye!

Signature · 4 lines
-gaspa-
-----------------------------------------------
-------- https://launchpad.net/~gaspa ---------
----- HomePage: http://gaspa.yattaweb.it ------
#1 lore raw

Hi Andrea,

first things first. What kernel version are you using?

Quoted 8 lines

Da: Andrea Gasparini <[email protected]>
Data: Fri, 25 Mar 2011 15:38:00 +0100
A: kernelnewbies at kernelnewbies.org
Oggetto: mac address inside eeprom.

Hi,
My system has an AT24 eeprom (drivers/misc/eeprom/at24.c), that contains the mac adress of my ethernet.

I looked at the latest version (2.6.38), and I saw that in include/linux/i2c/at24.h there is a structure to access the eeprom data. You should initialize that structure in your driver, or at boot, making it point to the eeprom address where the mac address is located.

Quoted 2 lines

Is there a standard way to retrieve data from other devices, that should be used inside drivers?

The standard way is always through the api's given in header files under the "include" directory.

Quoted 3 lines

I've already modified both at24.c and the ethernet driver to do so, but I'm wondering if there was already a better way.

Hope this is helping,

Cheers
Valentina

Quoted 12 lines

Thanks, bye!

Signature · 9 lines
-gaspa-
-----------------------------------------------
-------- https://launchpad.net/~gaspa ---------
----- HomePage: http://gaspa.yattaweb.it ------

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies> 
#2 lore raw

Hi Valentina,

In data venerd? 25 marzo 2011 17:22:58, Valentina Giusti ha scritto:

Quoted 1 line

first things first. What kernel version are you using?

2.6.38, as you said, is perfect.

Quoted 4 lines

I looked at the latest version (2.6.38), and I saw that in include/linux/i2c/at24.h there is a structure to access the eeprom data. You should initialize that structure in your driver, or at boot, making it point to the eeprom address where the mac address is located.

Uhm. I'm not sure that's the same thing you're saying, but looking at the header file gives me an idea.
So, probably the best way is using:

	void		(*setup)(struct memory_accessor *, void *context);

in my platform_device setup. So the setup code will be contained completely in the board-* file along with the other device specific setups. Cool :P

Quoted 1 line

Hope this is helping,

Sure, thanks a lot.
Bye.

Signature · 4 lines
-gaspa-
-----------------------------------------------
--------- http://launchpad.net/~gaspa ---------
------- HomePage: gaspa.yattaweb.it --------