Need help to write I2C EEPROM device driver

4 messages, 2 authors, 2006-09-27 · open the first message on its own page

Need help to write I2C EEPROM device driver

From: Sachin Rane <hidden>
Date: 2006-09-26 14:34:37

Hi,
 
I am looking for an information to write a device driver to access EEPROM IC M24C02-WBN6.
The EEPROM IC M24C02-WBN is present on the 'ppc440' evaluation board for boot strap purpose.
 
I have refferred materials available on:
1. some of the material available on www.lm-sensors.org <https://mail.alphion.com/exchweb/bin/redir.asp?URL=http://www.lm-sensors.org>  site
2. Device Driver code for EEPOM IC available on http://lists.lm-sensors.org/pipermail/lm-sensors/2005-July/013021.html <https://mail.alphion.com/exchweb/bin/redir.asp?URL=http://lists.lm-sensors.org/pipermail/lm-sensors/2005-July/013021.html> 
3. The documents available in "/usr/src/linux/Documentation/i2c" directory.
4. I2C Drivers, Part I  --> http://www.linuxjournal.com/node/7136/print <https://mail.alphion.com/exchweb/bin/redir.asp?URL=http://www.linuxjournal.com/node/7136/print> 
   I2C Drivers, Part II  --> http://www.linuxjournal.com/node/7252/print <https://mail.alphion.com/exchweb/bin/redir.asp?URL=http://www.linuxjournal.com/node/7252/print> 
5. Data sheet of IC M24C02-WBN6
6. I2C protocol document (Philips)
 
But I am not getting a proper link which can help me to write a device driver.
 
Could you  give me answer to my (silly) queries?
 
Q1. Which way is more appropiate to access a EEPOM chip?
      ---- a. Accessing through Adapter device driver (adpter driver in turn will acess the chip device driver)
      ---- b. Or a /dev/ character device file node for the EEPROM IC (by registering a charcter device driver)
      As the IC is laying on the I2C bus with the Read (0xA0) and write(0xA1) address, I have to access it through Adapter device driver only. 

Q2. As there are two address available for read and Write operation, at which address location the the i2c_probe() will find the device?

Q3. Can I use i2c_smbus_XXXXXXX functions to do interaction with the EEPROM I2C?
    ---- As per my understanding it should  work as SMB is subset of I2C.
 
Q4. Where I can get the purpose of 'command' argument in 'i2c_smbus_XXXX' functions from 'i2c.h'?
      extern s32 i2c_smbus_read_byte_data(struct i2c_client * client, u8 command);
      extern s32 i2c_smbus_write_byte_data(struct i2c_client * client, u8 command, u8 value);
      extern s32 i2c_smbus_read_word_data(struct i2c_client * client, u8 command);
      extern s32 i2c_smbus_write_word_data(struct i2c_client * client, u8 command, u16 value);
      extern s32 i2c_smbus_write_block_data(struct i2c_client * client, u8 command, u8 length, u8 *values);
       extern s32 i2c_smbus_read_i2c_block_data(struct i2c_client * client,  u8 command, u8 *values);
 
Q4. Is there any guide available on Net for writing a I2C EEMPROM Chip device driver?
 
 
Regards,
Sachin Rane

Links that I have gone through:
http://www.lm-sensors.org/browser/lm-sensors/trunk/doc <https://mail.alphion.com/exchweb/bin/redir.asp?URL=http://www.lm-sensors.org/browser/lm-sensors/trunk/doc> 
http://www.lm-sensors.org/browser/lm-sensors/trunk <https://mail.alphion.com/exchweb/bin/redir.asp?URL=http://www.lm-sensors.org/browser/lm-sensors/trunk> 
http://www.lm-sensors.org/browser/lm-sensors/trunk/doc/developers <https://mail.alphion.com/exchweb/bin/redir.asp?URL=http://www.lm-sensors.org/browser/lm-sensors/trunk/doc/developers> 
http://www.lm-sensors.org/browser/lm-sensors/trunk/doc/chips/adm1024 <https://mail.alphion.com/exchweb/bin/redir.asp?URL=http://www.lm-sensors.org/browser/lm-sensors/trunk/doc/chips/adm1024> 
http://www.lm-sensors.org/browser/lm-sensors/trunk/doc/developers <https://mail.alphion.com/exchweb/bin/redir.asp?URL=http://www.lm-sensors.org/browser/lm-sensors/trunk/doc/developers> 
http://www.lm-sensors.org/browser/lm-sensors/trunk/doc/developers/new_drivers <https://mail.alphion.com/exchweb/bin/redir.asp?URL=http://www.lm-sensors.org/browser/lm-sensors/trunk/doc/developers/new_drivers> 
http://www.lm-sensors.org/browser/lm-sensors/trunk/doc/FAQ <https://mail.alphion.com/exchweb/bin/redir.asp?URL=http://www.lm-sensors.org/browser/lm-sensors/trunk/doc/FAQ> 
http://www.lm-sensors.org/browser/lm-sensors/trunk/prog <https://mail.alphion.com/exchweb/bin/redir.asp?URL=http://www.lm-sensors.org/browser/lm-sensors/trunk/prog> 
http://www.lm-sensors.org/browser/lm-sensors/trunk/prog/doc <https://mail.alphion.com/exchweb/bin/redir.asp?URL=http://www.lm-sensors.org/browser/lm-sensors/trunk/prog/doc> 
http://www.lm-sensors.org/browser/lm-sensors/trunk/prog/eeprom <https://mail.alphion.com/exchweb/bin/redir.asp?URL=http://www.lm-sensors.org/browser/lm-sensors/trunk/prog/eeprom> 
http://www.lm-sensors.org/browser/lm-sensors/trunk/prog/eeprom/ddcmon <https://mail.alphion.com/exchweb/bin/redir.asp?URL=http://www.lm-sensors.org/browser/lm-sensors/trunk/prog/eeprom/ddcmon> 
http://www.lm-sensors.org/browser/lm-sensors/trunk/prog/eepromer <https://mail.alphion.com/exchweb/bin/redir.asp?URL=http://www.lm-sensors.org/browser/lm-sensors/trunk/prog/eepromer> 
http://www.lm-sensors.org/browser/lm-sensors/trunk/prog/eepromer/24cXX.c <https://mail.alphion.com/exchweb/bin/redir.asp?URL=http://www.lm-sensors.org/browser/lm-sensors/trunk/prog/eepromer/24cXX.c> 
http://www.lm-sensors.org/browser/lm-sensors/trunk/prog/eepromer/eeprom.c <https://mail.alphion.com/exchweb/bin/redir.asp?URL=http://www.lm-sensors.org/browser/lm-sensors/trunk/prog/eepromer/eeprom.c> 
http://www.lm-sensors.org/browser/lm-sensors/trunk/prog/eepromer/README <https://mail.alphion.com/exchweb/bin/redir.asp?URL=http://www.lm-sensors.org/browser/lm-sensors/trunk/prog/eepromer/README> 
http://www.lm-sensors.org/browser/lm-sensors/trunk/prog/eepromer/README.eeprom <https://mail.alphion.com/exchweb/bin/redir.asp?URL=http://www.lm-sensors.org/browser/lm-sensors/trunk/prog/eepromer/README.eeprom> 
http://www.lm-sensors.org/wiki/Devices <https://mail.alphion.com/exchweb/bin/redir.asp?URL=http://www.lm-sensors.org/wiki/Devices> 
http://www.lm-sensors.org/wiki/Documentation <https://mail.alphion.com/exchweb/bin/redir.asp?URL=http://www.lm-sensors.org/wiki/Documentation> 

Re: Need help to write I2C EEPROM device driver

From: Matthias Fuchs <hidden>
Date: 2006-09-27 10:29:24

Hi Sachin,

there is already a driver for this part in the kernel 
(drivers/i2c/chips/eeprom.c). 

BTW: to do some simple reads and writes to an I2C EEPROM it is very simple to 
access the EEPROM via read/write/ioctl through /dev/i2c-<x>. No driver - only 
userland code.

Matthias


On Tuesday 26 September 2006 16:34, Sachin Rane wrote:
Hi,
 
I am looking for an information to write a device driver to access EEPROM IC 
M24C02-WBN6.
The EEPROM IC M24C02-WBN is present on the 'ppc440' evaluation board for 
boot strap purpose.

RE: Need help to write I2C EEPROM device driver

From: Sachin Rane <hidden>
Date: 2006-09-27 14:12:47

Hi Matthias,
 
Thanks for reply.
 
To access EEPROM using /dev/i2c-<x>, which drivers I need to load?
 
Please confirm that I need to load following drivers:
1. i2c-core.ko (Core Driver)
2. i2c-ibm-iic.ko (Bus Driver)
3. i2c-dev.ko (Dev Interface driver)
 
Do I need to load 'eeprom.ko'?
Because in one of the mail from the mailing list, it was mentioned that I should not load  ''eeprom.ko" to access the chip using 'dev' interface.
 
Thanks and Regards,
Sachin Rane

________________________________

From: Matthias Fuchs [mailto:matthias.fuchs@esd-electronics.com]
Sent: Wed 9/27/2006 6:21 AM
To: linuxppc-embedded@ozlabs.org
Cc: Sachin Rane
Subject: Re: Need help to write I2C EEPROM device driver



Hi Sachin,

there is already a driver for this part in the kernel
(drivers/i2c/chips/eeprom.c).

BTW: to do some simple reads and writes to an I2C EEPROM it is very simple to
access the EEPROM via read/write/ioctl through /dev/i2c-<x>. No driver - only
userland code.

Matthias


On Tuesday 26 September 2006 16:34, Sachin Rane wrote:
Hi,

I am looking for an information to write a device driver to access EEPROM IC
M24C02-WBN6.
The EEPROM IC M24C02-WBN is present on the 'ppc440' evaluation board for
boot strap purpose.

Re: Need help to write I2C EEPROM device driver

From: Matthias Fuchs <hidden>
Date: 2006-09-27 14:54:06

On Wednesday 27 September 2006 16:11, Sachin Rane wrote:
To access EEPROM using /dev/i2c-<x>, which drivers I need to load?
 
Please confirm that I need to load following drivers:
1. i2c-core.ko (Core Driver)
2. i2c-ibm-iic.ko (Bus Driver)
3. i2c-dev.ko (Dev Interface driver)
That looks good.
Do I need to load 'eeprom.ko'?
No.
Because in one of the mail from the mailing list, it was mentioned that I 
should not load  ''eeprom.ko" to access the chip using 'dev' interface.
Either use access via /dev/i2c-x or via eeprom driver. I haven't used the 
later one so far. Using both at the same time is probably not possible.

Matthias
 
Thanks and Regards,
Sachin Rane

________________________________

From: Matthias Fuchs [mailto:matthias.fuchs@esd-electronics.com]
Sent: Wed 9/27/2006 6:21 AM
To: linuxppc-embedded@ozlabs.org
Cc: Sachin Rane
Subject: Re: Need help to write I2C EEPROM device driver



Hi Sachin,

there is already a driver for this part in the kernel
(drivers/i2c/chips/eeprom.c).

BTW: to do some simple reads and writes to an I2C EEPROM it is very simple 
to
access the EEPROM via read/write/ioctl through /dev/i2c-<x>. No driver - 
only
userland code.

Matthias


On Tuesday 26 September 2006 16:34, Sachin Rane wrote:
quoted
Hi,

I am looking for an information to write a device driver to access EEPROM 
IC
M24C02-WBN6.
quoted
The EEPROM IC M24C02-WBN is present on the 'ppc440' evaluation board for
boot strap purpose.

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help