linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* tqm5200s i2c bus timeout
@ 2013-01-03 13:20 Johannes Braun
  2013-01-03 13:25 ` Johannes Braun
  2013-01-03 14:11 ` Anatolij Gustschin
  0 siblings, 2 replies; 6+ messages in thread
From: Johannes Braun @ 2013-01-03 13:20 UTC (permalink / raw)
  To: linuxppc-dev

Hello,

I hope someone could help me with my problem. Currently I am porting
a new kernel (3.3.8) for a tqm5200s based board.
The previous kernel was 2.6.23. The new kernel version is needed because
of support for a wireless card.

I got issues with the i2c bus and this kernel. When the kernel boots up,
the i2c initialization ends in a timout. This is the kernel log:

[    1.460652] i2c /dev entries driver
[    1.465434] mpc-i2c f0003d40.i2c: timeout 1000000 us

Connected to the bus is an eeprom (Microchip 24c32a) and a realtime
clock (Philips PCF8563).
The i2c bus section in the dtb file looks as follows:

i2c@3d40 {
     #address-cells = <1>;
     #size-cells = <0>;
     compatible = "fsl,mpc5200-i2c","fsl-i2c";
     reg = <0x3d40 0x40>;
     interrupts = <2 16 0>;
     fsl5200-clocking;
};

The dtb file from the kernel 2.6.23 looks as follows:
i2c@3d40 {

#address-cells = <1>;
     #size-cells = <0>;
     compatible = "fsl,mpc5200-i2c","fsl-i2c";
     reg = <0x3d40 0x40>;
     interrupts = <2 16 0>;
     fsl5200-clocking;
};

I can`t see any devices in /sys/bus/i2c/devices except the bus itself.
# ls /sys/bus/i2c/devices
# i2c-0
# cat /sys/bus/i2c/devices/i2c-0/name
# MPC adapter

Is there something wrong with my dtb file or is it a bug in the mpc-i2c driver

Best regards
Johannes

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

* Re: tqm5200s i2c bus timeout
  2013-01-03 13:20 tqm5200s i2c bus timeout Johannes Braun
@ 2013-01-03 13:25 ` Johannes Braun
  2013-01-03 14:11 ` Anatolij Gustschin
  1 sibling, 0 replies; 6+ messages in thread
From: Johannes Braun @ 2013-01-03 13:25 UTC (permalink / raw)
  To: linuxppc-dev

> The dtb file from the kernel 2.6.23 looks as follows:
> i2c@3d40 {
>
> #address-cells = <1>;
>      #size-cells = <0>;
>      compatible = "fsl,mpc5200-i2c","fsl-i2c";
>      reg = <0x3d40 0x40>;
>      interrupts = <2 16 0>;
>      fsl5200-clocking;
> };

sry, but this was a mistake. This is the correct section from the kernel 2.6.23:

i2c@3d40 {
    device_type = "i2c";
    compatible = "mpc5200-i2c\0fsl-i2c";
    cell-index= <1>;
    reg = <3d40 40>;
    interrupts = <2 10 0>;
    interrupt-parent = <&mpc5200_pic>;
    fsl5200-clocking;
};

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

* Re: tqm5200s i2c bus timeout
  2013-01-03 13:20 tqm5200s i2c bus timeout Johannes Braun
  2013-01-03 13:25 ` Johannes Braun
@ 2013-01-03 14:11 ` Anatolij Gustschin
  2013-01-04  7:50   ` Johannes Braun
  1 sibling, 1 reply; 6+ messages in thread
From: Anatolij Gustschin @ 2013-01-03 14:11 UTC (permalink / raw)
  To: Johannes Braun; +Cc: linuxppc-dev

Hi,

On Thu, 3 Jan 2013 14:20:41 +0100
Johannes Braun <jjo.braun@gmail.com> wrote:

> Hello,
> 
> I hope someone could help me with my problem. Currently I am porting
> a new kernel (3.3.8) for a tqm5200s based board.
> The previous kernel was 2.6.23. The new kernel version is needed because
> of support for a wireless card.
> 
> I got issues with the i2c bus and this kernel. When the kernel boots up,
> the i2c initialization ends in a timout. This is the kernel log:
> 
> [    1.460652] i2c /dev entries driver
> [    1.465434] mpc-i2c f0003d40.i2c: timeout 1000000 us

No, the initialization doesn't end in timeout. It is just an info
which timeout value will be used for i2c transfers.

> 
> Connected to the bus is an eeprom (Microchip 24c32a) and a realtime
> clock (Philips PCF8563).
> The i2c bus section in the dtb file looks as follows:
> 
> i2c@3d40 {
>      #address-cells = <1>;
>      #size-cells = <0>;
>      compatible = "fsl,mpc5200-i2c","fsl-i2c";
>      reg = <0x3d40 0x40>;
>      interrupts = <2 16 0>;
>      fsl5200-clocking;

This "fsl5200-clocking" property is not needed anymore, you can remove it.

> };

> 
> The dtb file from the kernel 2.6.23 looks as follows:
> i2c@3d40 {
> 
> #address-cells = <1>;
>      #size-cells = <0>;
>      compatible = "fsl,mpc5200-i2c","fsl-i2c";
>      reg = <0x3d40 0x40>;
>      interrupts = <2 16 0>;
>      fsl5200-clocking;
> };
> 
> I can`t see any devices in /sys/bus/i2c/devices except the bus itself.
> # ls /sys/bus/i2c/devices
> # i2c-0
> # cat /sys/bus/i2c/devices/i2c-0/name
> # MPC adapter

This is expected since you didn't add sub-nodes for your i2c devices
24c32a and PCF8563 in the i2c adapter node.

> Is there something wrong with my dtb file or is it a bug in the mpc-i2c driver

It is an issue with our dtb file. Please look at the I2C eeprom
sub-node in the arch/powerpc/boot/dts/mpc5121ads.dts file and at
the pcf8563 RTC sub-node in the arch/powerpc/boot/dts/mucmc52.dts
file for an example how to add needed nodes for your devices.

Thanks,
Anatolij

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

* Re: tqm5200s i2c bus timeout
  2013-01-03 14:11 ` Anatolij Gustschin
@ 2013-01-04  7:50   ` Johannes Braun
  2013-01-04 10:49     ` Anatolij Gustschin
  0 siblings, 1 reply; 6+ messages in thread
From: Johannes Braun @ 2013-01-04  7:50 UTC (permalink / raw)
  To: Anatolij Gustschin; +Cc: linuxppc-dev

> This is expected since you didn't add sub-nodes for your i2c devices
> 24c32a and PCF8563 in the i2c adapter node.

Ok this was the issue.

>> Is there something wrong with my dtb file or is it a bug in the mpc-i2c driver
>
> It is an issue with our dtb file. Please look at the I2C eeprom
> sub-node in the arch/powerpc/boot/dts/mpc5121ads.dts file and at
> the pcf8563 RTC sub-node in the arch/powerpc/boot/dts/mucmc52.dts
> file for an example how to add needed nodes for your devices.

According to the two examples, I added the subnodes to both i2c nodes.
Now I can see the rtc clock and the eeproms in /sys/..
# root@generic-powerpc:/sys/bus/i2c/devices# ls
# 0-0050  1-0050  1-0051  i2c-0   i2c-1

Now the i2c section in my dtb file looks as follows:
i2c@3d00 {
   #address-cells = <1>;
   #size-cells = <0>;
   compatible = "fsl,mpc5200-i2c","fsl-i2c";
   reg = <0x3d00 0x00>;
   interrupts = <2 15 0>;

   eeprom@50 {
      compatible = "at,24c32";
      reg = <0x50>;
   };
};

i2c@3d40 {
   #address-cells = <1>;
   #size-cells = <0>;
   compatible = "fsl,mpc5200-i2c","fsl-i2c";
   reg = <0x3d40 0x40>;
   interrupts = <2 16 0>;

   eeprom@50 {
      compatible = "at,24c32";
      reg = <0x50>;
   };

   rtc@51 {
      compatible = "pcf8563";
      reg = <0x51>;
   };
};


The good thing is that I can see all the devices now. Also the driver
for the rtc clock is loading. But the time can`t be read through the
registered rtc0 device. This is the kernel log. But I think this is a
driver issue and I should have a look inside the driver.

[    1.483761] rtc-pcf8563 1-0051: chip found, driver version 0.4.3
[    1.490382] rtc-pcf8563 1-0051: pcf8563_get_datetime: read error
[    1.497478] rtc-pcf8563 1-0051: rtc core: registered rtc-pcf8563 as rtc0
...
...
[    1.536540] rtc-pcf8563 1-0051: pcf8563_get_datetime: read error
[    1.542759] rtc-pcf8563 1-0051: hctosys: unable to read the hardware clock


Thanks,
Johannes

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

* Re: tqm5200s i2c bus timeout
  2013-01-04  7:50   ` Johannes Braun
@ 2013-01-04 10:49     ` Anatolij Gustschin
  2013-01-04 11:30       ` Johannes Braun
  0 siblings, 1 reply; 6+ messages in thread
From: Anatolij Gustschin @ 2013-01-04 10:49 UTC (permalink / raw)
  To: Johannes Braun; +Cc: linuxppc-dev

On Fri, 4 Jan 2013 08:50:03 +0100
Johannes Braun <jjo.braun@gmail.com> wrote:
...
> The good thing is that I can see all the devices now. Also the driver
> for the rtc clock is loading. But the time can`t be read through the
> registered rtc0 device. This is the kernel log. But I think this is a
> driver issue and I should have a look inside the driver.
> 
> [    1.483761] rtc-pcf8563 1-0051: chip found, driver version 0.4.3
> [    1.490382] rtc-pcf8563 1-0051: pcf8563_get_datetime: read error
> [    1.497478] rtc-pcf8563 1-0051: rtc core: registered rtc-pcf8563 as rtc0

The RTC slave address is correct. Is the pcf8563 RTC on I2C2 bus on
your board?

Thanks,
Anatolij

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

* Re: tqm5200s i2c bus timeout
  2013-01-04 10:49     ` Anatolij Gustschin
@ 2013-01-04 11:30       ` Johannes Braun
  0 siblings, 0 replies; 6+ messages in thread
From: Johannes Braun @ 2013-01-04 11:30 UTC (permalink / raw)
  Cc: linuxppc-dev

>> The good thing is that I can see all the devices now. Also the driver
>> for the rtc clock is loading. But the time can`t be read through the
>> registered rtc0 device. This is the kernel log. But I think this is a
>> driver issue and I should have a look inside the driver.
>>
>> [    1.483761] rtc-pcf8563 1-0051: chip found, driver version 0.4.3
>> [    1.490382] rtc-pcf8563 1-0051: pcf8563_get_datetime: read error
>> [    1.497478] rtc-pcf8563 1-0051: rtc core: registered rtc-pcf8563 as rtc0
>
> The RTC slave address is correct. Is the pcf8563 RTC on I2C2 bus on
> your board?

My address was not correct. The rtc clock is on I2C1 bus. I moved the
rtc node to the I2C1 node. The rtc clock works now.

Thanks,
Johannes

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

end of thread, other threads:[~2013-01-04 11:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-03 13:20 tqm5200s i2c bus timeout Johannes Braun
2013-01-03 13:25 ` Johannes Braun
2013-01-03 14:11 ` Anatolij Gustschin
2013-01-04  7:50   ` Johannes Braun
2013-01-04 10:49     ` Anatolij Gustschin
2013-01-04 11:30       ` Johannes Braun

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).