UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Observer alexlear
Observer
5,613 Views
Registered: ‎08-19-2009

Getting I2C EEPROM driver to work in Petalinux

I'm having some difficulty getting the EEPROM driver working in Petalinux v2013.10.

 

I have two I2C connections to a Zynq PS running at 400kHz.  ps7_i2c_1 is the EEPROM connection.  The device I am using is a MicroChip 24LC128.  All three chip address inputs are grounded for a 0x50 address.  I have editted the system.dts file as follows to add the EEPROM:

 

ps7_i2c_0: ps7-i2c@e0004000 {
        bus-id = <0>;
        clocks = <&clkc 38>;
        compatible = "xlnx,ps7-i2c-1.00.a";
        i2c-clk = <400000>;
        interrupt-parent = <&ps7_scugic_0>;
        interrupts = <0 25 4>;
        reg = <0xe0004000 0x1000>;
        xlnx,has-interrupt = <0x0>;
} ;
ps7_i2c_1: ps7-i2c@e0005000 {
        bus-id = <1>;
        clocks = <&clkc 39>;
        compatible = "xlnx,ps7-i2c-1.00.a";
        i2c-clk = <400000>;
        interrupt-parent = <&ps7_scugic_0>;
        interrupts = <0 48 4>;
        reg = <0xe0005000 0x1000>;
        xlnx,has-interrupt = <0x0>;
        xlnx,i2c-reset = "<Select>";
        eeprom@50 {
                compatible = "at24,24c128";
                reg = <0x50>;
                };
} ; 

 

I've also configured the kernel with ->Device Drivers->Misc Devices->EEPROM Support->I2C EEPROM from most vendors

 

When I boot petalinux, I see these entries for I2C in the terminal output:

 

....

i2c /dev entries driver
xi2cps e0004000.ps7-i2c: 400 kHz mmio e0004000 irq 57
xi2cps e0005000.ps7-i2c: 400 kHz mmio e0005000 irq 80

....

 

I don't see the device "file" that I expect at: /sys/bus/i2c/devices/1-0050/eeprom

 

/dev/ lists both i2c-0 and i2c-1 but I'd like to use the EEPROM driver.

 

I haven't used EEPROM from petalinux in this way before so maybe I am missing something.  Any help is appreciated!

 

Thanks!

 

Alex

0 Kudos
1 Reply
Observer alexlear
Observer
5,582 Views
Registered: ‎08-19-2009

Re: Getting I2C EEPROM driver to work in Petalinux

To follow up on my own post....

 

After verifying the configuration/drivers and rebuilding the kernel and rootfs it appears to now be working.  The above method is correct.  In researching this I also found that you can also instantiate the eeprom device from userspace with:

 

echo eeprom 0x50 > /sys/bus/i2c/devices/i2c-1/new_device

 

- Alex

0 Kudos