Search code examples
linux-device-driveri2c

Linux I2C driver porting issue


I am porting an I2C driver to Linux-4. This device provides multiple I2C addresses for different function simultaneously.

For example:

address 0xAA is for access of SPI flash. 
address 0xA0 is for access of EEPROM.  
address 0x60 is for normal access (control purpose).  

Is it possible to support access of different I2C address in single-one I2C device driver?

Any help appreciated, Thanks


Solution

  • Thanks for Dražen Grašovec and user2699113 's help.

    I am porting a I2C device driver (chip, client) to Linux-4.9. This chip accepts different I2C device address for different purpose. My goal is to create only one I2C device on Linux device tree file (.dts)

    I resolved my issue by using i2c_new_dummy().

    In driver probe function, I made two i2c_new_dummy() to create two additional i2c clients.
    One(client#1) is for accessing of I2C address 0xAA, another(client#2) is for I2C address 0xA0.
    So I can use client#1 to communicate with its SPI flash and use client#2 to access it EEPROM.