Skip to contentSkip to conversation

MPC5200 I2C and 2.6 kernel

DISCUSSION Oliver Rutsch 3 participants 4 messages Nov 27, 2007 – Nov 29, 2007

lore
Share & tools
lore
#0 lore raw

Hi,

I'm using a TQM5200S (MPC5200B CPU) module on the STK52xx starter kit. For some reasons I have to use the 2.6 kernel (the latest 2.6.23.1 from the DENX git archive) with ARCH=powerpc and most of my external hardware is running fine with this. On the starter kit there is an external I2C RTC (M41T00) and I like to use it now. In the 2.4 kernel there were some options regarding MPC5200 I2C, but I could not find them in the 2.6 kernel.
There were options for MPCxxx I2C Algorithm or MPC5xxx TQM5200 I2C Adapter, for example.
Regardless what I'm doing in the 2.6 kernel configuration I can't get this RTC running (I activated RTC support and the driver for the M41T00 in the configuration).
hwclock --debug tells me:

hwclock: Open of /dev/rtc failed, errno=19: No such device. No usable clock interface found.

So the questions is: Is the I2C support for the MPC5200 in the 2.6.23 kernel in an usable state? Or do I need some special patches from TQ for this board to get it running?

Thanks in advance and bye,

Signature · 2 lines
Dipl. Ing. Oliver Rutsch
EMail: [email protected]
#1 lore raw
Quoted 7 lines · In message <[email protected]> you wrote:

Regardless what I'm doing in the 2.6 kernel configuration I can't get this RTC running (I activated RTC support and the driver for the M41T00 in the configuration).
hwclock --debug tells me:

hwclock: Open of /dev/rtc failed, errno=19: No such device.

Well... did you check how your /dev/rtc is set up? It used to be a misc device with MAJ=10 MIN=135 in old kernel versions, but now it's MAJ=254 MIN=4, i. e. it should look like this:

crw-r--r-- 1 root root 254, 0 Jun 22 18:30 /dev/rtc

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: [email protected]
For every complex problem, there is a solution that is simple,  neat,
and wrong.                                           -- H. L. Mencken
#2 lore raw
Quoted 6 lines · Wolfgang Denk
Quoted 5 lines · In message <[email protected]> you wrote:

Regardless what I'm doing in the 2.6 kernel configuration I can't get this RTC running (I activated RTC support and the driver for the M41T00 in the configuration).
hwclock --debug tells me:

You have to add the i2c device to this table in arch/powerpc/sysdev/fsl_soc.c

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",},
};

Then make a device tree node for it with the address.

		i2c@3d40 {
			compatible = "mpc5200b-i2c","mpc5200-i2c","fsl-i2c";
			reg = <3d40 40>;
			interrupts = <2 10 0>;
			interrupt-parent = <&mpc5200_pic>;
			fsl5200-clocking;

			rtc@51 {
				compatible = "epson,rtc8564";
				reg = <51>;
			};
		};

The device will be named /dev/rtc0. A more update to date version of hwclock will find it or you can make a symlink from rtc to rtc0.

When it works right:
rtc-pcf8563 1-0051: rtc core: registered rtc-pcf8563 as rtc0 rtc-pcf8563 1-0051: setting system clock to 2007-11-28 16:53:12 UTC (1196268792)

I have a pending series of patches that removes this table and moves the aliasing into the i2c drivers. It is waiting for a core change to go into the i2c subsystem.

Quoted 24 lines
Quoted 1 line

hwclock: Open of /dev/rtc failed, errno=19: No such device.

Well... did you check how your /dev/rtc is set up? It used to be a misc device with MAJ=10 MIN=135 in old kernel versions, but now it's MAJ=254 MIN=4, i. e. it should look like this:

crw-r--r-- 1 root root 254, 0 Jun 22 18:30 /dev/rtc

Best regards,

Wolfgang Denk

--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: [email protected] For every complex problem, there is a solution that is simple, neat,
and wrong. -- H. L. Mencken
_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Signature · 2 lines
Jon Smirl
[email protected]
#3 lore raw
In reply to Wolfgang Denk

Hi,

Quoted 10 lines
Quoted 3 lines

hwclock --debug tells me:

hwclock: Open of /dev/rtc failed, errno=19: No such device.

Well... did you check how your /dev/rtc is set up? It used to be a misc device with MAJ=10 MIN=135 in old kernel versions, but now it's MAJ=254 MIN=4, i. e. it should look like this:

crw-r--r-- 1 root root 254, 0 Jun 22 18:30 /dev/rtc

Yes this was not correct in my filesystem. But in your filesystem it looks like MAJ=254 MIN=0. I set MIN to 0 and applied Jon's suggestions and now it works! So many thanks to Wolfgang and Jon, this was really a hard problem for me!
But I should mention that I modified my dts for the M41T00 RTC in the following way:

	rtc@68 {
		compatible = "stm,m41t00";
		reg = <68>;
	};

In some piece of an older driver I found the I2C Address for this RTC (0x68), although the data sheet tells me that the slave address is 0xD0. However, now it's up and running!

Thanks and bye,

Signature · 2 lines
Dipl. Ing. Oliver Rutsch
EMail: [email protected]