linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Device tree configuration for I2C eeprom
@ 2008-09-18 19:44 Ayman El-Khashab
  2008-09-18 22:13 ` Sebastian Siewior
  0 siblings, 1 reply; 15+ messages in thread
From: Ayman El-Khashab @ 2008-09-18 19:44 UTC (permalink / raw)
  To: Linuxppc-embedded

I am eluded by how exactly to configure the device tree for my external
I2C eeprom AND once that happens, how do I use the eeprom driver for
linux to read/write the device.

I am using the newest kernel 2.6.27-rc6 since it has apparently the best
support for the 28C128 EEPROM devices.  My design is based on the
canyonlands PPC460EX board.
=20
The RTC in the device tree shows up as expected in the
/proc/device-tree, but I am not sure what the configuration of the
eeprom should look like. =20

Here is a snippet from the dts file, and I assume I need something like
what I've added:
=20
                        IIC0: i2c@ef600700 {
                                compatible =3D "ibm,iic-460ex", =
"ibm,iic";
                                reg =3D <ef600700 14>;
                                interrupt-parent =3D <&UIC0>;
                                interrupts =3D <2 4>;
                                #address-cells =3D <1>;
                                #size-cells =3D <0>;
                                rtc@68 {
                                        compatible =3D "stm,m41t80";
                                        reg =3D <68>;
                                };
                                eeprom@50 {
                                        compatible =3D "?????";
 						    something
                                        something;
                                };
   =20
Once I do all that, how does one use the eeprom driver to read and write
this part?

Thanks

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Device tree configuration for I2C eeprom
  2008-09-18 19:44 Device tree configuration for I2C eeprom Ayman El-Khashab
@ 2008-09-18 22:13 ` Sebastian Siewior
  2008-09-18 22:21   ` Jon Smirl
  0 siblings, 1 reply; 15+ messages in thread
From: Sebastian Siewior @ 2008-09-18 22:13 UTC (permalink / raw)
  To: Ayman El-Khashab; +Cc: Linuxppc-embedded

* Ayman El-Khashab | 2008-09-18 14:44:44 [-0500]:

>Here is a snippet from the dts file, and I assume I need something like
>what I've added:
> 
>                        IIC0: i2c@ef600700 {
>                                compatible = "ibm,iic-460ex", "ibm,iic";
>                                reg = <ef600700 14>;
>                                interrupt-parent = <&UIC0>;
>                                interrupts = <2 4>;
>                                #address-cells = <1>;
>                                #size-cells = <0>;
>                                rtc@68 {
>                                        compatible = "stm,m41t80";
>                                        reg = <68>;
>                                };
>                                eeprom@50 {
>                                        compatible = "?????";
> 						    something
>                                        something;
>                                };

This should look like:
|                        IIC0: i2c@ef600700 {
|                                compatible = "ibm,iic-460ex", "ibm,iic";
|                                reg = <ef600700 14>;
|                                interrupt-parent = <&UIC0>;
|                                interrupts = <2 4>;
|                                #address-cells = <1>;
|                                #size-cells = <0>;
|                                rtc@68 {
|                                        compatible = "m41t80";
|                                        reg = <68>;
|                                };
|                                eeprom@50 {
|                                        compatible = "eeprom";
|                                        reg = <50>;
|                                };

Compatible is the ID of the driver. You can find it in the driver
itself: if you look in ./drivers/rtc/rtc-m41t80.c you will find a struct
m41t80_id which contains the ids. The same applies to the eeprom driver.
You might want to update your dts from current kernel tree which
contains the "/dts-v1/" tag at the beginning and then your field must
contain an 0x prefix.

>Once I do all that, how does one use the eeprom driver to read and write
>this part?
The eeprom driver should create an eeprom file somewhere in /sys I am
not sure where exactly. The help entry in Kconfig says that is module
provides only RO access to the eeprom.

Sebastian

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Device tree configuration for I2C eeprom
  2008-09-18 22:13 ` Sebastian Siewior
@ 2008-09-18 22:21   ` Jon Smirl
  2008-09-19  5:04     ` Grant Likely
  0 siblings, 1 reply; 15+ messages in thread
From: Jon Smirl @ 2008-09-18 22:21 UTC (permalink / raw)
  To: Sebastian Siewior; +Cc: Ayman El-Khashab, Linuxppc-embedded

On Thu, Sep 18, 2008 at 6:13 PM, Sebastian Siewior
<linuxppc-embedded@ml.breakpoint.cc> wrote:
> * Ayman El-Khashab | 2008-09-18 14:44:44 [-0500]:
>
>>Here is a snippet from the dts file, and I assume I need something like
>>what I've added:
>>
>>                        IIC0: i2c@ef600700 {
>>                                compatible = "ibm,iic-460ex", "ibm,iic";
>>                                reg = <ef600700 14>;
>>                                interrupt-parent = <&UIC0>;
>>                                interrupts = <2 4>;
>>                                #address-cells = <1>;
>>                                #size-cells = <0>;
>>                                rtc@68 {
>>                                        compatible = "stm,m41t80";
>>                                        reg = <68>;
>>                                };
>>                                eeprom@50 {
>>                                        compatible = "?????";
>>                                                   something
>>                                        something;
>>                                };
>
> This should look like:
> |                        IIC0: i2c@ef600700 {
> |                                compatible = "ibm,iic-460ex", "ibm,iic";
> |                                reg = <ef600700 14>;
> |                                interrupt-parent = <&UIC0>;
> |                                interrupts = <2 4>;
> |                                #address-cells = <1>;
> |                                #size-cells = <0>;
> |                                rtc@68 {
> |                                        compatible = "m41t80";
> |                                        reg = <68>;
> |                                };
> |                                eeprom@50 {
> |                                        compatible = "eeprom";


The new eeprom driver is at24, eeprom is the old one. at24 has write support.

EEPROMs from most vendors (AT24)

Enable this driver to get read/write support to most I2C EEPROMs,
after you configure the driver to know about each EEPROM on
your target board. Use these generic chip names, instead of
vendor-specific ones like at24c64 or 24lc02:

24c00, 24c01, 24c02, spd (readonly 24c02), 24c04, 24c08,
24c16, 24c32, 24c64, 24c128, 24c256, 24c512, 24c1024

Unless you like data loss puzzles, always be sure that any chip
you configure as a 24c32 (32 kbit) or larger is NOT really a
24c16 (16 kbit) or smaller, and vice versa. Marking the chip
as read-only won't help recover from this. Also, if your chip
has any software write-protect mechanism you may want to review the
code to make sure this driver won't turn it on by accident.

If you use this with an SMBus adapter instead of an I2C adapter,
full functionality is not available. Only smaller devices are
supported (24c16 and below, max 4 kByte).

This driver can also be built as a module. If so, the module
will be called at24.
> |                                        reg = <50>;
> |                                };
>
> Compatible is the ID of the driver. You can find it in the driver
> itself: if you look in ./drivers/rtc/rtc-m41t80.c you will find a struct
> m41t80_id which contains the ids. The same applies to the eeprom driver.
> You might want to update your dts from current kernel tree which
> contains the "/dts-v1/" tag at the beginning and then your field must
> contain an 0x prefix.
>
>>Once I do all that, how does one use the eeprom driver to read and write
>>this part?
> The eeprom driver should create an eeprom file somewhere in /sys I am
> not sure where exactly. The help entry in Kconfig says that is module
> provides only RO access to the eeprom.
>
> Sebastian
> _______________________________________________
> Linuxppc-embedded mailing list
> Linuxppc-embedded@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-embedded
>



-- 
Jon Smirl
jonsmirl@gmail.com

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Device tree configuration for I2C eeprom
  2008-09-18 22:21   ` Jon Smirl
@ 2008-09-19  5:04     ` Grant Likely
  2008-09-19  7:12       ` Sebastian Siewior
  2008-11-04 16:07       ` Ayman El-Khashab
  0 siblings, 2 replies; 15+ messages in thread
From: Grant Likely @ 2008-09-19  5:04 UTC (permalink / raw)
  To: Jon Smirl; +Cc: Ayman El-Khashab, devicetree-discuss, Linuxppc-embedded

On Thu, Sep 18, 2008 at 06:21:36PM -0400, Jon Smirl wrote:
> On Thu, Sep 18, 2008 at 6:13 PM, Sebastian Siewior
> <linuxppc-embedded@ml.breakpoint.cc> wrote:
> >>                                eeprom@50 {
> >>                                        compatible = "?????";
> >>                                                   something
> >>                                        something;
> >>                                };
> >
> > This should look like:
> > |                                eeprom@50 {
> > |                                        compatible = "eeprom";
> 
> 
> The new eeprom driver is at24, eeprom is the old one. at24 has write support.
> 
> EEPROMs from most vendors (AT24)
> 
> Enable this driver to get read/write support to most I2C EEPROMs,
> after you configure the driver to know about each EEPROM on
> your target board. Use these generic chip names, instead of
> vendor-specific ones like at24c64 or 24lc02:
> 
> 24c00, 24c01, 24c02, spd (readonly 24c02), 24c04, 24c08,
> 24c16, 24c32, 24c64, 24c128, 24c256, 24c512, 24c1024

No, don't use the generic chip names.  Device tree convention is to be
specific and prefix the part number with the vendor name.  ie. You should
be using "at,at24c64", not "24c64".

g.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Device tree configuration for I2C eeprom
  2008-09-19  5:04     ` Grant Likely
@ 2008-09-19  7:12       ` Sebastian Siewior
  2008-09-19  7:44         ` Grant Likely
  2008-11-04 16:28         ` Grant Likely
  2008-11-04 16:07       ` Ayman El-Khashab
  1 sibling, 2 replies; 15+ messages in thread
From: Sebastian Siewior @ 2008-09-19  7:12 UTC (permalink / raw)
  To: Grant Likely; +Cc: Ayman El-Khashab, devicetree-discuss, Linuxppc-embedded

* Grant Likely | 2008-09-18 22:04:41 [-0700]:

>No, don't use the generic chip names.  Device tree convention is to be
>specific and prefix the part number with the vendor name.  ie. You should
>be using "at,at24c64", not "24c64".

What about the i2c drivers which don't have any prefix like the m41t80?
Prior commit 0d1cde2 aka "powerpc/i2c: Convert i2c-mpc into an
of_platform driver" the ids were converted.

>
>g.
>

Sebastian

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Device tree configuration for I2C eeprom
  2008-09-19  7:12       ` Sebastian Siewior
@ 2008-09-19  7:44         ` Grant Likely
  2008-09-19  8:12           ` Sebastian Siewior
  2008-11-04 16:28         ` Grant Likely
  1 sibling, 1 reply; 15+ messages in thread
From: Grant Likely @ 2008-09-19  7:44 UTC (permalink / raw)
  To: Sebastian Siewior; +Cc: Ayman El-Khashab, devicetree-discuss, Linuxppc-embedded

On Fri, Sep 19, 2008 at 09:12:38AM +0200, Sebastian Siewior wrote:
> * Grant Likely | 2008-09-18 22:04:41 [-0700]:
> 
> >No, don't use the generic chip names.  Device tree convention is to be
> >specific and prefix the part number with the vendor name.  ie. You should
> >be using "at,at24c64", not "24c64".
> 
> What about the i2c drivers which don't have any prefix like the m41t80?
> Prior commit 0d1cde2 aka "powerpc/i2c: Convert i2c-mpc into an
> of_platform driver" the ids were converted.

Important Concept:  If the driver can't match with nodes that conform with
the device tree binding conventions, then it is a *Linux/device driver* bug;
not a device tree bug.  The device tree describes hardware.  It does not
describe the device driver implementation.

Do not fall into the temptation of writing the device tree to reflect
the current implementation of the operating system.  Stick to
established conventions and documented bindings.

That being said, it is a non-issue in this case.  The current Linux OF
support code automagically strips off the manufacturer prefix when
registering I2C devices.  Take a look at of_modalias_node() in
drivers/of/base.c for details.

g.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Device tree configuration for I2C eeprom
  2008-09-19  7:44         ` Grant Likely
@ 2008-09-19  8:12           ` Sebastian Siewior
  0 siblings, 0 replies; 15+ messages in thread
From: Sebastian Siewior @ 2008-09-19  8:12 UTC (permalink / raw)
  To: Grant Likely; +Cc: Ayman El-Khashab, devicetree-discuss, Linuxppc-embedded

* Grant Likely | 2008-09-19 00:44:58 [-0700]:

>Do not fall into the temptation of writing the device tree to reflect
>the current implementation of the operating system.  Stick to
>established conventions and documented bindings.
>
>That being said, it is a non-issue in this case.  The current Linux OF
>support code automagically strips off the manufacturer prefix when
>registering I2C devices.  Take a look at of_modalias_node() in
>drivers/of/base.c for details.
Thanks for this information.

>
>g.

Sebastian

^ permalink raw reply	[flat|nested] 15+ messages in thread

* RE: Device tree configuration for I2C eeprom
  2008-09-19  5:04     ` Grant Likely
  2008-09-19  7:12       ` Sebastian Siewior
@ 2008-11-04 16:07       ` Ayman El-Khashab
  2008-11-04 16:45         ` Felix Radensky
  1 sibling, 1 reply; 15+ messages in thread
From: Ayman El-Khashab @ 2008-11-04 16:07 UTC (permalink / raw)
  To: Linuxppc-embedded, devicetree-discuss

Grant Likely <> said on :
>>>>                                };
>>>=20
>>> This should look like:
>>>>                                eeprom@50 {
>>>>                                        compatible =3D "eeprom";
>>=20
>>=20
>> The new eeprom driver is at24, eeprom is the old one. at24 has write
>> support.=20
>>=20
>> EEPROMs from most vendors (AT24)
>>=20
>> Enable this driver to get read/write support to most I2C EEPROMs,
>> after you configure the driver to know about each EEPROM on your
>> target board. Use these generic chip names, instead of
>> vendor-specific ones like at24c64 or 24lc02:=20
>>=20
>> 24c00, 24c01, 24c02, spd (readonly 24c02), 24c04, 24c08, 24c16,
>> 24c32, 24c64, 24c128, 24c256, 24c512, 24c1024
>=20
> No, don't use the generic chip names.  Device tree convention
> is to be specific and prefix the part number with the vendor
> name.  ie. You should be using "at,at24c64", not "24c64".
>=20

Ok, here is what I used.  I see the nodes created in /sys/bus/i2c/...=20
but I see four of them at address 0x50,0x51,0x52,0x53.  That surprised
me since I only have 3 of them in the device tree.  However, in any case
I did not see a way to read or write them.  In one case I was able to
cat the file "eeprom", but it was only 256 bytes and did not exist for
the other 3 devices.  Here is the section of my device tree ... I do=20
see the controller being initialized in dmesg, it is just the read and
write that is eluding me.

One question I did have was within another sample device tree, there was
a comment that "this makes address 0x50 and 0x51"?  Does that mean that
large eeproms are spread over several nodes?  I searched around but
could
not find an example of how to use this at24 to access my E2 from
userspace.

Thanks
Ayman


                        IIC0: i2c@ef600700 {
                                compatible =3D "ibm,iic-460ex", =
"ibm,iic";
                                reg =3D <0xef600700 0x00000014>;
                                interrupt-parent =3D <&UIC0>;
                                interrupts =3D <0x2 0x4>;
                                #address-cells =3D <1>;
                                #size-cells =3D <0>;

                                at24@50 {
                                        compatible =3D "at24,at24c128";
                                        reg =3D <0x50>;
                                };
                                at24@52 {
                                        compatible =3D "at24,at24c128";
                                        reg =3D <0x52>;
                                };
                                at24@53 {
                                        compatible =3D "at24,at24c128";
                                        reg =3D <0x53>;
                                };
				}

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Device tree configuration for I2C eeprom
  2008-09-19  7:12       ` Sebastian Siewior
  2008-09-19  7:44         ` Grant Likely
@ 2008-11-04 16:28         ` Grant Likely
  2008-11-04 16:29           ` Grant Likely
  1 sibling, 1 reply; 15+ messages in thread
From: Grant Likely @ 2008-11-04 16:28 UTC (permalink / raw)
  To: Sebastian Siewior; +Cc: Ayman El-Khashab, devicetree-discuss, Linuxppc-embedded

On Fri, Sep 19, 2008 at 12:12 AM, Sebastian Siewior
<linuxppc-embedded@ml.breakpoint.cc> wrote:
> * Grant Likely | 2008-09-18 22:04:41 [-0700]:
>
>>No, don't use the generic chip names.  Device tree convention is to be
>>specific and prefix the part number with the vendor name.  ie. You should
>>be using "at,at24c64", not "24c64".
>
> What about the i2c drivers which don't have any prefix like the m41t80?
> Prior commit 0d1cde2 aka "powerpc/i2c: Convert i2c-mpc into an
> of_platform driver" the ids were converted.

That is the *driver* not the device tree description.  The OF i2c code
is still converts the name.  By default it does this by simply
stripping off the manufacturer prefix, but the match table does still
exist when the default behavior needs to be overridden.

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Device tree configuration for I2C eeprom
  2008-11-04 16:28         ` Grant Likely
@ 2008-11-04 16:29           ` Grant Likely
  2008-11-04 17:17             ` Sebastian Andrzej Siewior
  0 siblings, 1 reply; 15+ messages in thread
From: Grant Likely @ 2008-11-04 16:29 UTC (permalink / raw)
  To: Sebastian Siewior; +Cc: Ayman El-Khashab, devicetree-discuss, Linuxppc-embedded

On Tue, Nov 4, 2008 at 9:28 AM, Grant Likely <grant.likely@secretlab.ca> wrote:
> On Fri, Sep 19, 2008 at 12:12 AM, Sebastian Siewior
> <linuxppc-embedded@ml.breakpoint.cc> wrote:
>> * Grant Likely | 2008-09-18 22:04:41 [-0700]:
>>
>>>No, don't use the generic chip names.  Device tree convention is to be
>>>specific and prefix the part number with the vendor name.  ie. You should
>>>be using "at,at24c64", not "24c64".
>>
>> What about the i2c drivers which don't have any prefix like the m41t80?
>> Prior commit 0d1cde2 aka "powerpc/i2c: Convert i2c-mpc into an
>> of_platform driver" the ids were converted.
>
> That is the *driver* not the device tree description.  The OF i2c code
> is still converts the name.  By default it does this by simply
> stripping off the manufacturer prefix, but the match table does still
> exist when the default behavior needs to be overridden.

Oops, I already replied to this one.  Sorry for the duplicate response.

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Device tree configuration for I2C eeprom
  2008-11-04 16:07       ` Ayman El-Khashab
@ 2008-11-04 16:45         ` Felix Radensky
  2008-11-04 19:52           ` Ayman El-Khashab
  0 siblings, 1 reply; 15+ messages in thread
From: Felix Radensky @ 2008-11-04 16:45 UTC (permalink / raw)
  To: Ayman El-Khashab; +Cc: Linuxppc-embedded

Ayman El-Khashab wrote:
>
> Ok, here is what I used.  I see the nodes created in /sys/bus/i2c/... 
> but I see four of them at address 0x50,0x51,0x52,0x53.  That surprised
> me since I only have 3 of them in the device tree.  However, in any case
> I did not see a way to read or write them.  In one case I was able to
> cat the file "eeprom", but it was only 256 bytes and did not exist for
> the other 3 devices.  Here is the section of my device tree ... I do 
> see the controller being initialized in dmesg, it is just the read and
> write that is eluding me.
>
> One question I did have was within another sample device tree, there was
> a comment that "this makes address 0x50 and 0x51"?  Does that mean that
> large eeproms are spread over several nodes?  I searched around but
> could
> not find an example of how to use this at24 to access my E2 from
> userspace.
>
> Thanks
> Ayman
>
>
>                         IIC0: i2c@ef600700 {
>                                 compatible = "ibm,iic-460ex", "ibm,iic";
>                                 reg = <0xef600700 0x00000014>;
>                                 interrupt-parent = <&UIC0>;
>                                 interrupts = <0x2 0x4>;
>                                 #address-cells = <1>;
>                                 #size-cells = <0>;
>
>                                 at24@50 {
>                                         compatible = "at24,at24c128";
>                                         reg = <0x50>;
>                                 };
>                                 at24@52 {
>                                         compatible = "at24,at24c128";
>                                         reg = <0x52>;
>                                 };
>                                 at24@53 {
>                                         compatible = "at24,at24c128";
>                                         reg = <0x53>;
>                                 };
> 				}
>
>
>   
If you're using Denx kernel, you should add your  at24 device to 
i2c_devices[]
in drivers/i2c/busses/i2c-ibm_of.c This will pass your device tree data 
to at24 driver.

Felix.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Device tree configuration for I2C eeprom
  2008-11-04 16:29           ` Grant Likely
@ 2008-11-04 17:17             ` Sebastian Andrzej Siewior
  0 siblings, 0 replies; 15+ messages in thread
From: Sebastian Andrzej Siewior @ 2008-11-04 17:17 UTC (permalink / raw)
  To: Grant Likely; +Cc: Ayman El-Khashab, devicetree-discuss, Linuxppc-embedded

* Grant Likely | 2008-11-04 09:29:09 [-0700]:

>Oops, I already replied to this one.  Sorry for the duplicate response.

No worries. You haven't been that detailed like the last time :)

>g.

Sebastian

^ permalink raw reply	[flat|nested] 15+ messages in thread

* RE: Device tree configuration for I2C eeprom
  2008-11-04 16:45         ` Felix Radensky
@ 2008-11-04 19:52           ` Ayman El-Khashab
  2008-11-04 20:04             ` Felix Radensky
  0 siblings, 1 reply; 15+ messages in thread
From: Ayman El-Khashab @ 2008-11-04 19:52 UTC (permalink / raw)
  To: Linuxppc-embedded, i2c

Felix Radensky <mailto:felix@embedded-sol.com> said on Tuesday, November
04, 2008 10:46 AM:

>
> If you're using Denx kernel, you should add your  at24 device
> to i2c_devices[] in drivers/i2c/busses/i2c-ibm_of.c This will
> pass your device tree data to at24 driver.

I am using the Denx kernel and I see the at24 printing out in dmesg.
Here is=20
my latest device tree.  Further, I changed the aforementioned file by
adding
the following lines as shown.  The at24 driver is in i2c/chips/at24.c

But I still do not see anything obvious show up that I can open to read
and
write the eeprom ... what am I missing.  I would have thought there must
be
a working example somewhere?



static struct i2c_driver_device i2c_devices[] __initdata =3D {
        {"ricoh,rs5c372a", "rtc-rs5c372", "rs5c372a",},
        {"ricoh,rs5c372b", "rtc-rs5c372", "rs5c372b",},
        {"ricoh,rv5c386",  "rtc-rs5c372", "rv5c386",},
        {"ricoh,rv5c387a", "rtc-rs5c372", "rv5c387a",},
        {"dallas,ds1307",  "rtc-ds1307",  "ds1307",},
        {"dallas,ds1337",  "rtc-ds1307",  "ds1337",},
        {"dallas,ds1338",  "rtc-ds1307",  "ds1338",},
        {"dallas,ds1339",  "rtc-ds1307",  "ds1339",},
        {"dallas,ds1340",  "rtc-ds1307",  "ds1340",},
        {"stm,m41t00",     "rtc-ds1307",  "m41t00"},
        {"dallas,ds1374",  "rtc-ds1374",  "rtc-ds1374",},
        {"stm,m41t80",     "rtc-m41t80",  "m41t80",},
        {"atmel,at24c128", "at24",        "at24c128",},
        {"spd,at24c02",    "at24",        "at24c02",},
};



                       IIC0: i2c@ef600700 {
                                compatible =3D "ibm,iic-460ex", =
"ibm,iic";
                                reg =3D <0xef600700 0x00000014>;
                                interrupt-parent =3D <&UIC0>;
                                interrupts =3D <0x2 0x4>;
                                #address-cells =3D <1>;
                                #size-cells =3D <0>;

                                at24@50 {
                                        compatible =3D "atmel,at24c128";
                                        reg =3D <0x50>;
                                };
                                spd@51 {
                                        compatible =3D "spd,at24c02";
                                        reg =3D <0x51>;
                                };
                                at24@52 {
                                        compatible =3D "atmel,at24c128";
                                        reg =3D <0x52>;
                                };
                                at24@53 {
                                        compatible =3D "atmel,at24c128";
                                        reg =3D <0x53>;
                                };

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Device tree configuration for I2C eeprom
  2008-11-04 19:52           ` Ayman El-Khashab
@ 2008-11-04 20:04             ` Felix Radensky
  2008-11-04 21:00               ` Ayman El-Khashab
  0 siblings, 1 reply; 15+ messages in thread
From: Felix Radensky @ 2008-11-04 20:04 UTC (permalink / raw)
  To: Ayman El-Khashab; +Cc: Linuxppc-embedded

Ayman El-Khashab wrote:
> Felix Radensky <mailto:felix@embedded-sol.com> said on Tuesday, November
> 04, 2008 10:46 AM:
>
>   
>> If you're using Denx kernel, you should add your  at24 device
>> to i2c_devices[] in drivers/i2c/busses/i2c-ibm_of.c This will
>> pass your device tree data to at24 driver.
>>     
>
> I am using the Denx kernel and I see the at24 printing out in dmesg.
> Here is 
> my latest device tree.  Further, I changed the aforementioned file by
> adding
> the following lines as shown.  The at24 driver is in i2c/chips/at24.c
>
> But I still do not see anything obvious show up that I can open to read
> and
> write the eeprom ... what am I missing.  I would have thought there must
> be
> a working example somewhere?
>
>
>
> static struct i2c_driver_device i2c_devices[] __initdata = {
>         {"ricoh,rs5c372a", "rtc-rs5c372", "rs5c372a",},
>         {"ricoh,rs5c372b", "rtc-rs5c372", "rs5c372b",},
>         {"ricoh,rv5c386",  "rtc-rs5c372", "rv5c386",},
>         {"ricoh,rv5c387a", "rtc-rs5c372", "rv5c387a",},
>         {"dallas,ds1307",  "rtc-ds1307",  "ds1307",},
>         {"dallas,ds1337",  "rtc-ds1307",  "ds1337",},
>         {"dallas,ds1338",  "rtc-ds1307",  "ds1338",},
>         {"dallas,ds1339",  "rtc-ds1307",  "ds1339",},
>         {"dallas,ds1340",  "rtc-ds1307",  "ds1340",},
>         {"stm,m41t00",     "rtc-ds1307",  "m41t00"},
>         {"dallas,ds1374",  "rtc-ds1374",  "rtc-ds1374",},
>         {"stm,m41t80",     "rtc-m41t80",  "m41t80",},
>         {"atmel,at24c128", "at24",        "at24c128",},
>         {"spd,at24c02",    "at24",        "at24c02",},
> };
>
>
>
>                        IIC0: i2c@ef600700 {
>                                 compatible = "ibm,iic-460ex", "ibm,iic";
>                                 reg = <0xef600700 0x00000014>;
>                                 interrupt-parent = <&UIC0>;
>                                 interrupts = <0x2 0x4>;
>                                 #address-cells = <1>;
>                                 #size-cells = <0>;
>
>                                 at24@50 {
>                                         compatible = "atmel,at24c128";
>                                         reg = <0x50>;
>                                 };
>                                 spd@51 {
>                                         compatible = "spd,at24c02";
>                                         reg = <0x51>;
>                                 };
>                                 at24@52 {
>                                         compatible = "atmel,at24c128";
>                                         reg = <0x52>;
>                                 };
>                                 at24@53 {
>                                         compatible = "atmel,at24c128";
>                                         reg = <0x53>;
>                                 };
>   
The first entry in the table matches "compatible" property in device tree,
the second one - i2c driver name, and the third one - i2c device name in
the driver id table (see at24_ids[] in at24.c). So in your case it should
look like this:

{"atmel,at24c128",  "at24",   "24c128"}
{"spd,at24c02",       "at24",   "spd"}

Felix.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* RE: Device tree configuration for I2C eeprom
  2008-11-04 20:04             ` Felix Radensky
@ 2008-11-04 21:00               ` Ayman El-Khashab
  0 siblings, 0 replies; 15+ messages in thread
From: Ayman El-Khashab @ 2008-11-04 21:00 UTC (permalink / raw)
  Cc: Linuxppc-embedded

Hello Felix,

Thanks, below is what I finally did that works ...

Felix Radensky <mailto:felix@embedded-sol.com> said on Tuesday, November
04, 2008 2:04 PM:
>>=20
> The first entry in the table matches "compatible" property in device
> tree, the second one - i2c driver name, and the third one - i2c
> device name in the driver id table (see at24_ids[] in at24.c). So in
> your case it should look like this:
>=20
> {"atmel,at24c128",  "at24",   "24c128"}
> {"spd,at24c02",       "at24",   "spd"}

Then I modified my device tree to read, per an example I found
elsewhere.  The combination
of these two changes made everything work.  Again, thanks!

                                at24@50 {
                                        compatible =3D "at,24c128";
                                        reg =3D <0x50>;
                                };
                                spd@51 {
                                        compatible =3D "spd,24c02";
                                        reg =3D <0x51>;
                                };
                                at24@52 {
                                        compatible =3D "at,24c128";
                                        reg =3D <0x52>;
                                };
                                at24@53 {
                                        compatible =3D "at,24c128";
                                        reg =3D <0x53>;
                                };

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2008-11-04 21:00 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-18 19:44 Device tree configuration for I2C eeprom Ayman El-Khashab
2008-09-18 22:13 ` Sebastian Siewior
2008-09-18 22:21   ` Jon Smirl
2008-09-19  5:04     ` Grant Likely
2008-09-19  7:12       ` Sebastian Siewior
2008-09-19  7:44         ` Grant Likely
2008-09-19  8:12           ` Sebastian Siewior
2008-11-04 16:28         ` Grant Likely
2008-11-04 16:29           ` Grant Likely
2008-11-04 17:17             ` Sebastian Andrzej Siewior
2008-11-04 16:07       ` Ayman El-Khashab
2008-11-04 16:45         ` Felix Radensky
2008-11-04 19:52           ` Ayman El-Khashab
2008-11-04 20:04             ` Felix Radensky
2008-11-04 21:00               ` Ayman El-Khashab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).