linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* mpc870: hctosys.c unable to open rtc device rtc0
@ 2010-08-09  6:37 Shawn Jin
  2010-08-09 17:29 ` Scott Wood
  0 siblings, 1 reply; 4+ messages in thread
From: Shawn Jin @ 2010-08-09  6:37 UTC (permalink / raw)
  To: ppcdev

A DS1339 RTC is connected to the I2C bus (i2c-cpm in mpc870). The
dmesg below shows that the ds1037 driver was registered. But the
hctosys.c was not able to open the rtc device rtc0. The rtc doesn't
seem to be connected with I2C driver properly.

i2c-core: driver [rtc-ds1307] registered
i2c /dev entries driver
i2c-core: driver [dev_driver] registered
fsl-i2c-cpm fa200860.i2c: cpm_i2c_setup()
  alloc irq_desc for 21 on node 0
  alloc kstat_irqs on node 0
irq: irq 16 on host /soc@fa200000/cpm@9c0/interrupt-controller@930
mapped to virtual irq 21
fsl-i2c-cpm fa200860.i2c: i2c_ram 0xfddfbc80, i2c_addr 0x1c80, freq 60000
fsl-i2c-cpm fa200860.i2c: tbase 0x0340, rbase 0x0360
i2c i2c-0: adapter [i2c-cpm] registered
i2c-dev: adapter [i2c-cpm] registered as minor 0
fsl-i2c-cpm fa200860.i2c: hw routines for i2c-cpm registered.
i2c-core: driver [lm75] registered
TCP cubic registered
NET: Registered protocol family 17
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)

My I2C settings in the dts is as follows, same as the mpc885ads.

                        i2c@860 {
                                compatible = "fsl,mpc885-i2c",
                                             "fsl,cpm1-i2c";
                                reg = <0x860 0x20 0x3c80 0x30>;
                                interrupts = <16>;
                                interrupt-parent = <&CPM_PIC>;
                                fsl,cpm-command = <0x10>;
                                #address-cells = <1>;
                                #size-cells = <0>;
                        };

Reading the fsl i2c bindings in the documentation, I found an example
as follows.
  27      i2c@860 {
  28                compatible = "fsl,mpc823-i2c",
  29                             "fsl,cpm1-i2c";
  30                reg = <0x860 0x20 0x3c80 0x30>;
  31                interrupts = <16>;
  32                interrupt-parent = <&CPM_PIC>;
  33                fsl,cpm-command = <0x10>;
  34                #address-cells = <1>;
  35                #size-cells = <0>;
  36
  37                rtc@68 {
  38                        compatible = "dallas,ds1307";
  39                        reg = <0x68>;
  40                };
  41        };
  42

In the above example the rtc was explicitly declared as a subnode of
the i2c node. Is this the way to connect (or bind) a RTC to the I2C
driver? If not how is an RTC driver (or hwmon driver) bound to the I2C
driver? What is the reg (0x68) under rtc node?

I set breakpoint at ds1037_probe() and was hoping that it might be hit
during the driver registration. But it didn't. Would the
ds1037_probe() be called during when the ds1037_driver was registered
as an I2C driver?

Thanks,
-Shawn.

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

* Re: mpc870: hctosys.c unable to open rtc device rtc0
  2010-08-09  6:37 mpc870: hctosys.c unable to open rtc device rtc0 Shawn Jin
@ 2010-08-09 17:29 ` Scott Wood
  2010-08-09 21:05   ` Shawn Jin
  0 siblings, 1 reply; 4+ messages in thread
From: Scott Wood @ 2010-08-09 17:29 UTC (permalink / raw)
  To: Shawn Jin; +Cc: ppcdev

On Sun, 8 Aug 2010 23:37:00 -0700
Shawn Jin <shawnxjin@gmail.com> wrote:

> Reading the fsl i2c bindings in the documentation, I found an example
> as follows.
>   27      i2c@860 {
>   28                compatible = "fsl,mpc823-i2c",
>   29                             "fsl,cpm1-i2c";
>   30                reg = <0x860 0x20 0x3c80 0x30>;
>   31                interrupts = <16>;
>   32                interrupt-parent = <&CPM_PIC>;
>   33                fsl,cpm-command = <0x10>;
>   34                #address-cells = <1>;
>   35                #size-cells = <0>;
>   36
>   37                rtc@68 {
>   38                        compatible = "dallas,ds1307";
>   39                        reg = <0x68>;
>   40                };
>   41        };
>   42
> 
> In the above example the rtc was explicitly declared as a subnode of
> the i2c node. Is this the way to connect (or bind) a RTC to the I2C
> driver?

Yes.

> What is the reg (0x68) under rtc node?

It's the 7-bit I2C address (without the low-order direction bit).

> I set breakpoint at ds1037_probe() and was hoping that it might be hit
> during the driver registration. But it didn't. Would the
> ds1037_probe() be called during when the ds1037_driver was registered
> as an I2C driver?

The probe function is called only if the device is declared.  There is
no autodetection.

-Scott

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

* Re: mpc870: hctosys.c unable to open rtc device rtc0
  2010-08-09 17:29 ` Scott Wood
@ 2010-08-09 21:05   ` Shawn Jin
  2010-08-10  7:07     ` Shawn Jin
  0 siblings, 1 reply; 4+ messages in thread
From: Shawn Jin @ 2010-08-09 21:05 UTC (permalink / raw)
  To: Scott Wood; +Cc: ppcdev

>> Reading the fsl i2c bindings in the documentation, I found an example
>> as follows.
>> =A0 27 =A0 =A0 =A0i2c@860 {
>> =A0 28 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0compatible =3D "fsl,mpc823-i2c",
>> =A0 29 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "fsl,cpm1=
-i2c";
>> =A0 30 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0reg =3D <0x860 0x20 0x3c80 0x30>;
>> =A0 31 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0interrupts =3D <16>;
>> =A0 32 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0interrupt-parent =3D <&CPM_PIC>;
>> =A0 33 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0fsl,cpm-command =3D <0x10>;
>> =A0 34 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0#address-cells =3D <1>;
>> =A0 35 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0#size-cells =3D <0>;
>> =A0 36
>> =A0 37 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0rtc@68 {
>> =A0 38 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0compatible =3D "da=
llas,ds1307";
>> =A0 39 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0reg =3D <0x68>;
>> =A0 40 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0};
>> =A0 41 =A0 =A0 =A0 =A0};
>> =A0 42
>>
>> In the above example the rtc was explicitly declared as a subnode of
>> the i2c node. Is this the way to connect (or bind) a RTC to the I2C
>> driver?
>
> Yes.

Thanks Scott for the confirmation. I added that to my dts file and the
driver did try to probe the device. But accessing the device timed
out. There are some microcode patches related to I2C that I've not
applied. I'll try the patch(es) later. But how can I find out which
patch should be applied to my MPC870?

Thanks,
-Shawn.

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

* Re: mpc870: hctosys.c unable to open rtc device rtc0
  2010-08-09 21:05   ` Shawn Jin
@ 2010-08-10  7:07     ` Shawn Jin
  0 siblings, 0 replies; 4+ messages in thread
From: Shawn Jin @ 2010-08-10  7:07 UTC (permalink / raw)
  To: Scott Wood; +Cc: ppcdev

> Thanks Scott for the confirmation. I added that to my dts file and the
> driver did try to probe the device. But accessing the device timed
> out. There are some microcode patches related to I2C that I've not
> applied. I'll try the patch(es) later. But how can I find out which
> patch should be applied to my MPC870?

:(, the I2C_SPI patch doesn't do any help. It still gets timeout when
probing the device. The slave address of DS1339 is 0x68. Here are the
debug messages. Before hooking up the oscilloscope, any quick hints
for me to try? The 2.4 kernel worked OK, BTW.

i2c-core: driver [rtc-ds1307] registered
i2c /dev entries driver
i2c-core: driver [dev_driver] registered
fsl-i2c-cpm fa200860.i2c: cpm_i2c_setup()
  alloc irq_desc for 21 on node 0
  alloc kstat_irqs on node 0
irq: irq 16 on host /soc@fa200000/cpm@9c0/interrupt-controller@930
mapped to virtual irq 21
fsl-i2c-cpm fa200860.i2c: i2c_ram 0xfddfa500, i2c_addr 0x0500, freq 60000
fsl-i2c-cpm fa200860.i2c: tbase 0x0340, rbase 0x0360
i2c i2c-0: adapter [i2c-cpm] registered
i2c-dev: adapter [i2c-cpm] registered as minor 0
fsl-i2c-cpm fa200860.i2c: hw routines for i2c-cpm registered.
i2c 0-0068: uevent
rtc-ds1307 0-0068: probe
i2c i2c-0: master_xfer[0] W, addr=0x68, len=1
i2c i2c-0: master_xfer[1] R, addr=0x68, len=2
i2c i2c-0: R: 0 T: 0
i2c i2c-0: cpm_i2c_write(abyte=0xd0)
i2c i2c-0: R: 0 T: 1
i2c i2c-0: cpm_i2c_read(abyte=0xd1)
i2c i2c-0: test ready.
i2c i2c-0: Interrupt: 2
i2c i2c-0: ready.
i2c i2c-0: tx sc 0 0x1400
i2c i2c-0: test ready.
i2c i2c-0: I2C transfer: timeout
i2c i2c-0: cpm_i2c_force_close()
rtc-ds1307: probe of 0-0068 failed with error -5
i2c i2c-0: client [ds1339] registered with bus id 0-0068
i2c-core: driver [lm75] registered
TCP cubic registered
NET: Registered protocol family 17
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
Freeing unused kernel memory: 1512k init

Thanks,
-Shawn.

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

end of thread, other threads:[~2010-08-10  7:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-09  6:37 mpc870: hctosys.c unable to open rtc device rtc0 Shawn Jin
2010-08-09 17:29 ` Scott Wood
2010-08-09 21:05   ` Shawn Jin
2010-08-10  7:07     ` Shawn Jin

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