Dr. H. Nikolaus Schaller | 1 May 2010 12:34
Picon
Favicon

Re: Bootstrapping a Debian Lenny rootfs for the 2.6 kernel

Hi Ruben,

Am 01.05.2010 um 11:54 schrieb Ruben Viets:

Hi Nikolaus,
 
The udev and zd1211-firmware are part of debian lenny packages. Downloadable below. 
 
http://packages.debian.org/lenny/udev
http://packages.debian.org/source/lenny/zd1211-firmware

Easier way would be to use:
apt-get install udev zd1211-firmware (You should attach a ethernet cable, then ;-))

Ah! I had thought that udev already had been installed by debootstrap... Sometimes things are much easier than one thinks :)

 
You really need some expert from skytone to fix the sources for below issues. Not me ;-)

Sure. I think there is some activity on qi-hardware.com They use the same series of processors for the NanoNote and maybe we can copy some nice stuff...

 - For the sound. ak4642en and jz_i2s.c, you need to change the sources manually, check my previous mail.
 
- For rtc you can disable the option to startup/reset the rtc everytime for boot in the kernel make xconfig. 

Or look what the error means... Basically I am doing all this to learn Kernel hacking and debugging :)

 - For the touchpad, there should be an easy way to connect the mice buttons to the GPIO. Otherwise just use a external mouse with scroll wheel.
 
- LCD jumps to the right, I think the changes did for minibook33.patch are not alway's consistant with the modifications needed for skytone (trendtac minibook).

I have not seen that yet - maybe it is a problem with the HSYNC timing not 100% in line with the LCD specs.

I have to add the above mentioned packages (plus some others) and then I can make the debian lenny rootfs available for easy download. Based on that, I hope there will be many differnt "Distributions" with a good selection of GUI and tools. E.g. upgrade to Ubuntu should become possible. Adding printer driver. Adding Browser, Mail, PIM etc. That is the good thing of a rock solid package base like Debian.

BR,
Nikolaus

Grt Ruben.
 
 
 
 
> CC: mipsbook-devel-CQP9ExgZy9rrZ44/DZwexQ@public.gmane.org
> From: hns-bdq14YP6qtRg9hUCZPvPmw@public.gmane.org
> To: r_viets-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org
> Subject: Re: [Mipsbook-devel] Bootstrapping a Debian Lenny rootfs for the 2.6 kernel
> Date: Fri, 30 Apr 2010 19:25:52 +0200
> 
> Hi Ruben,
> 
> Am 30.04.2010 um 14:53 schrieb Dr. H. Nikolaus Schaller:
> 
> > Now, the next steps are to fix the chroot /lenny and populate with 
> > more configuration (e.g. copy /etc/fstab, /etc/network/interfaces 
> > etc.) and applications (e.g. apt-get usbutils), WiFi firmware etc.
> >
> > Finally, it should be possible to copy all files from /lenny to / 
> > (after making a .tbz or .img and/or on a second SD card) and boot 
> > that.
> 
> My config now boots with a console login. I have attached the dmesg. 
> Of course, there are still some misconfigs to iron out.
> 
> Now, I want to try to get WiFi working. For that I need some more 
> hints because I have no experience in installing that myself (I always 
> had Linux systems where that was pre-installed)
> 
> > a) udev install
> 
> What do I need to download/install here?
> 
> > b) zd1211-firmware install
> 
> Where can I get that from?
> 
> > c) may need to update/reinstall wpa_supplicant (you need one without 
> > the compiled zydas driver, this only worked for kernel 2.4)
> 
> Ok.
> 
> > d) reconfigure /etc/wpa_supplicant.conf with the correct security 
> > encryption.
> 
> Ok.
> 
> > e) For easy use also add the /etc/network/interfaces and add the 
> > eth1 (or wifi, whatever you want to name it)
> 
> That is already part of the network/interfaces (I think it was 
> imported by debootstrap)
> 
> BR,
> Nikolaus
> 
> Excerpts from dmesg:
> 
> Creating 5 MTD partitions on "NAND 1GiB 3,3V 8-bit":
> 0x00000000-0x00100000 : "bootloader partition"
> 0x00100000-0x00400000 : "kernel partition"
> 0x00400000-0x00500000 : "mac partition"
> 0x00500000-0x00a00000 : "mini rootfs partition"
> 0x00a00000-0x40000000 : "yaffs2 rootfs partition"
> 
> indicates that we could flash the bootloader, kernel and rootfs from a 
> system installed on SD card.
> 
> Here is another section that indicates a problem:
> 
> drivers/hid/usbhid/hid-core.c: v2.6:USB HID core driver
> ---> ak4642en initialization!
> Write I2C device 0x13 failed.
> Write I2C device 0x13 failed.
> Write I2C device 0x13 failed.
> Write I2C device 0x13 failed.
> Write I2C device 0x13 failed.
> JzSOC On-Chip I2S controller registered (DAC: DMA(play):2/IRQ34,
> 
> Then the RTC
> 
> drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
> 
> And finally, it tries to ifup eth0 (but I had no cable attached)
> 
> eth0: JZ On-Chip ethernet (MAC 00:ef:a3:c1:00:03, IRQ 19)
> eth0: Found 1 PHY on JZ MAC
> eth0: Ethernet Module AutoNegotiation failed
> eth0: Provide Modes: (1)10BaseT-HD (2)10BaseT-FD (3)100baseTx-HD 
> (4)100baseTx-FD
> eth0: Ethernet Link offline!
> 
> 

New Windows 7: Simplify what you do everyday. Find the right PC for you.

<div>Hi Ruben,<div>
<br><div>
<div>Am 01.05.2010 um 11:54 schrieb Ruben Viets:</div>
<br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span"><div class="hmmessage">Hi Nikolaus,<br>&nbsp;<br>The udev and zd1211-firmware are part of debian lenny packages. Downloadable below.<span class="Apple-converted-space">&nbsp;</span><br>
</div></span></blockquote>
</div>
<div><blockquote type="cite"><span class="Apple-style-span"><div class="hmmessage">&nbsp;<br><a href="http://packages.debian.org/lenny/udev">http://packages.debian.org/lenny/udev</a><br><a href="http://packages.debian.org/source/lenny/zd1211-firmware">http://packages.debian.org/source/lenny/zd1211-firmware</a><br><br>Easier way would be to&nbsp;use:<br>apt-get install udev zd1211-firmware&nbsp;(You should attach a ethernet cable, then ;-))</div></span></blockquote></div>
<div><br></div>
<div>
<div>Ah! I had thought that udev already had been installed by debootstrap... Sometimes things are much easier than one thinks :)</div>
<div>
<br><blockquote type="cite"><span class="Apple-style-span"></span></blockquote>
</div>
</div>
<div>
<blockquote type="cite"><span class="Apple-style-span"><div class="hmmessage">&nbsp;<br>You really need some expert from skytone to fix the sources for below issues. Not me ;-)<br>
</div></span></blockquote>
<div><br></div>Sure. I think there is some activity on qi-hardware.com They use the same series of processors for the NanoNote and maybe we can copy some nice stuff...</div>
<div>
<br><blockquote type="cite"><span class="Apple-style-span"><div class="hmmessage">&nbsp;- For the sound. ak4642en and jz_i2s.c, you need to change the sources manually, check my previous mail.<br>&nbsp;<br>- For rtc you can disable the option to startup/reset the rtc everytime for boot in the kernel make xconfig.<span class="Apple-converted-space">&nbsp;</span><br>
</div></span></blockquote>
<div><br></div>Or look what the error means... Basically I am doing all this to learn Kernel hacking and debugging :)</div>
<div>
<br><blockquote type="cite"><span class="Apple-style-span"><div class="hmmessage">&nbsp;- For the touchpad, there should be an easy way to&nbsp;connect the mice buttons to the GPIO. Otherwise just use a external mouse with scroll wheel.<br>&nbsp;<br>- LCD jumps to the right, I think the changes did&nbsp;for minibook33.patch are not alway's consistant with the modifications needed&nbsp;for skytone (trendtac minibook).<br>
</div></span></blockquote>
<div><br></div>I have not seen that yet - maybe it is a problem with the HSYNC timing not 100% in line with the LCD specs.</div>
<div><br></div>
<div>I have to add the above mentioned packages (plus some others) and then I can make the debian lenny rootfs available for easy download. Based on that, I hope there will be many differnt "Distributions" with a good selection of GUI and tools. E.g. upgrade to Ubuntu should become possible. Adding printer driver. Adding Browser, Mail, PIM etc. That is the good thing of a rock solid package base like Debian.</div>
<div>
<div><br></div>BR,</div>
<div>Nikolaus</div>
<div>
<br><blockquote type="cite"><span class="Apple-style-span"><div class="hmmessage">Grt Ruben.<br>&nbsp;<br>&nbsp;<br>&nbsp;<br>&nbsp;<br>&gt; CC:<span class="Apple-converted-space">&nbsp;</span><a href="mailto:mipsbook-devel@...">mipsbook-devel@...</a><br>&gt; From:<span class="Apple-converted-space">&nbsp;</span><a href="mailto:hns@...">hns@...</a><br>&gt; To:<span class="Apple-converted-space">&nbsp;</span><a href="mailto:r_viets@...">r_viets@...</a><br>&gt; Subject: Re: [Mipsbook-devel] Bootstrapping a Debian Lenny rootfs for the 2.6 kernel<br>&gt; Date: Fri, 30 Apr 2010 19:25:52 +0200<br>&gt;<span class="Apple-converted-space">&nbsp;</span><br>&gt; Hi Ruben,<br>&gt;<span class="Apple-converted-space">&nbsp;</span><br>&gt; Am 30.04.2010 um 14:53 schrieb Dr. H. Nikolaus Schaller:<br>&gt;<span class="Apple-converted-space">&nbsp;</span><br>&gt; &gt; Now, the next steps are to fix the chroot /lenny and populate with<span class="Apple-converted-space">&nbsp;</span><br>&gt; &gt; more configuration (e.g. copy /etc/fstab, /etc/network/interfaces<span class="Apple-converted-space">&nbsp;</span><br>&gt; &gt; etc.) and applications (e.g. apt-get usbutils), WiFi firmware etc.<br>&gt; &gt;<br>&gt; &gt; Finally, it should be possible to copy all files from /lenny to /<span class="Apple-converted-space">&nbsp;</span><br>&gt; &gt; (after making a .tbz or .img and/or on a second SD card) and boot<span class="Apple-converted-space">&nbsp;</span><br>&gt; &gt; that.<br>&gt;<span class="Apple-converted-space">&nbsp;</span><br>&gt; My config now boots with a console login. I have attached the dmesg.<span class="Apple-converted-space">&nbsp;</span><br>&gt; Of course, there are still some misconfigs to iron out.<br>&gt;<span class="Apple-converted-space">&nbsp;</span><br>&gt; Now, I want to try to get WiFi working. For that I need some more<span class="Apple-converted-space">&nbsp;</span><br>&gt; hints because I have no experience in installing that myself (I always<span class="Apple-converted-space">&nbsp;</span><br>&gt; had Linux systems where that was pre-installed)<br>&gt;<span class="Apple-converted-space">&nbsp;</span><br>&gt; &gt; a) udev install<br>&gt;<span class="Apple-converted-space">&nbsp;</span><br>&gt; What do I need to download/install here?<br>&gt;<span class="Apple-converted-space">&nbsp;</span><br>&gt; &gt; b) zd1211-firmware install<br>&gt;<span class="Apple-converted-space">&nbsp;</span><br>&gt; Where can I get that from?<br>&gt;<span class="Apple-converted-space">&nbsp;</span><br>&gt; &gt; c) may need to update/reinstall wpa_supplicant (you need one without<span class="Apple-converted-space">&nbsp;</span><br>&gt; &gt; the compiled zydas driver, this only worked for kernel 2.4)<br>&gt;<span class="Apple-converted-space">&nbsp;</span><br>&gt; Ok.<br>&gt;<span class="Apple-converted-space">&nbsp;</span><br>&gt; &gt; d) reconfigure /etc/wpa_supplicant.conf with the correct security<span class="Apple-converted-space">&nbsp;</span><br>&gt; &gt; encryption.<br>&gt;<span class="Apple-converted-space">&nbsp;</span><br>&gt; Ok.<br>&gt;<span class="Apple-converted-space">&nbsp;</span><br>&gt; &gt; e) For easy use also add the /etc/network/interfaces and add the<span class="Apple-converted-space">&nbsp;</span><br>&gt; &gt; eth1 (or wifi, whatever you want to name it)<br>&gt;<span class="Apple-converted-space">&nbsp;</span><br>&gt; That is already part of the network/interfaces (I think it was<span class="Apple-converted-space">&nbsp;</span><br>&gt; imported by debootstrap)<br>&gt;<span class="Apple-converted-space">&nbsp;</span><br>&gt; BR,<br>&gt; Nikolaus<br>&gt;<span class="Apple-converted-space">&nbsp;</span><br>&gt; Excerpts from dmesg:<br>&gt;<span class="Apple-converted-space">&nbsp;</span><br>&gt; Creating 5 MTD partitions on "NAND 1GiB 3,3V 8-bit":<br>&gt; 0x00000000-0x00100000 : "bootloader partition"<br>&gt; 0x00100000-0x00400000 : "kernel partition"<br>&gt; 0x00400000-0x00500000 : "mac partition"<br>&gt; 0x00500000-0x00a00000 : "mini rootfs partition"<br>&gt; 0x00a00000-0x40000000 : "yaffs2 rootfs partition"<br>&gt;<span class="Apple-converted-space">&nbsp;</span><br>&gt; indicates that we could flash the bootloader, kernel and rootfs from a<span class="Apple-converted-space">&nbsp;</span><br>&gt; system installed on SD card.<br>&gt;<span class="Apple-converted-space">&nbsp;</span><br>&gt; Here is another section that indicates a problem:<br>&gt;<span class="Apple-converted-space">&nbsp;</span><br>&gt; drivers/hid/usbhid/hid-core.c: v2.6:USB HID core driver<br>&gt; ---&gt; ak4642en initialization!<br>&gt; Write I2C device 0x13 failed.<br>&gt; Write I2C device 0x13 failed.<br>&gt; Write I2C device 0x13 failed.<br>&gt; Write I2C device 0x13 failed.<br>&gt; Write I2C device 0x13 failed.<br>&gt; JzSOC On-Chip I2S controller registered (DAC: DMA(play):2/IRQ34,<br>&gt;<span class="Apple-converted-space">&nbsp;</span><br>&gt; Then the RTC<br>&gt;<span class="Apple-converted-space">&nbsp;</span><br>&gt; drivers/rtc/hctosys.c: unable to open rtc device (rtc0)<br>&gt;<span class="Apple-converted-space">&nbsp;</span><br>&gt; And finally, it tries to ifup eth0 (but I had no cable attached)<br>&gt;<span class="Apple-converted-space">&nbsp;</span><br>&gt; eth0: JZ On-Chip ethernet (MAC 00:ef:a3:c1:00:03, IRQ 19)<br>&gt; eth0: Found 1 PHY on JZ MAC<br>&gt; eth0: Ethernet Module AutoNegotiation failed<br>&gt; eth0: Provide Modes: (1)10BaseT-HD (2)10BaseT-FD (3)100baseTx-HD<span class="Apple-converted-space">&nbsp;</span><br>&gt; (4)100baseTx-FD<br>&gt; eth0: Ethernet Link offline!<br>&gt;<span class="Apple-converted-space">&nbsp;</span><br>&gt;<span class="Apple-converted-space">&nbsp;</span><br><br>New Windows 7: Simplify what you do everyday.<span class="Apple-converted-space">&nbsp;</span><a href="http://windows.microsoft.com/shop" target="_new">Find the right PC for you.</a>
</div></span></blockquote>
</div>
<br>
</div>
</div>
Steve Arnold | 1 May 2010 18:11
Favicon

Re: Bootstrapping a Debian Lenny rootfs for the 2.6 kernel

On Sat, 1 May 2010 12:34:21 +0200
"Dr. H. Nikolaus Schaller" <hns@...> wrote:

> Am 01.05.2010 um 11:54 schrieb Ruben Viets:
[snip]
> > - For rtc you can disable the option to startup/reset the rtc  
> > everytime for boot in the kernel make xconfig.

I see this in your dmesg:

PCF8563 RTC installed !!!

long before I see this:

drivers/rtc/hctosys.c: unable to open rtc device (rtc0)

so I guess I'd like to see your rtc and clock driver config
settings.  I'm assuming that CONFIG_RTC_DRV_PCF8563 is set or you
wouldn't get the first part, but I think it also depends on whether
it's built against the old or new rtc clock code.  I haven't built
2.6.24 in a long time, so maybe the old code is still enabled?

I guess it depends on what code is actually there (in that version
of the kernel) but you could try disabling either the old char
device rtc stuff or the new rtc code and see if that helps...

Trying to move everything to a newer kernel (2.6.33_rc?) might also
help, since there seems to be more and more embedded support (eg,
OLPC hardware support is now there) in the newest mainstream kernel.

Regards, Steve

PS. In general, the rtc stuff seems to like being built directly
into the kernel rather than as modules.

PPS. Two other approaches to building this stuff would be:

1) Create a hardware config for bitbake (didn't someone else
mention that at one point?)

2) Use a Gentoo-embedded ARM stage3 and build everything inside an
image file using Qemu (or do the debian thing in Qemu).  The
advantage of using Gentoo is full customization and the latest
toolchain, kernel/headers and glibc/uclibc, etc.

If I can ever get the time I will try the Gentoo/Qemu thing...

In case anyone is interested, there are some updated ebuilds for
qemuctl and qemu-launcher in my local overlay:

http://www.gentoogeek.org/portage-overlay/app-emulation/

and some (non-JZ) custom kernel ebuilds here:

http://www.gentoogeek.org/portage-overlay/sys-kernel/

Any patches are in the files/ dir in the ebuild directory, or on the
Gentoo distfiles mirrors (or in http://www.gentoogeek.org/files/).

Dr. H. Nikolaus Schaller | 1 May 2010 21:18
Picon
Favicon

Re: Bootstrapping a Debian Lenny rootfs for the 2.6 kernel

Hi Stephen,

Am 01.05.2010 um 18:11 schrieb Steve Arnold:

> On Sat, 1 May 2010 12:34:21 +0200
> "Dr. H. Nikolaus Schaller" <hns@...> wrote:
>
>> Am 01.05.2010 um 11:54 schrieb Ruben Viets:
> [snip]
>>> - For rtc you can disable the option to startup/reset the rtc
>>> everytime for boot in the kernel make xconfig.
>
> I see this in your dmesg:
>
> PCF8563 RTC installed !!!
>
> long before I see this:
>
> drivers/rtc/hctosys.c: unable to open rtc device (rtc0)

By looking into source file: this means  
rtc_class_open(CONFIG_RTC_HCTOSYS_DEVICE) returns NULL.  
CONFIG_RTC_HCTOSYS_DEVICE is "rtc0".

>
> so I guess I'd like to see your rtc and clock driver config
> settings.  I'm assuming that CONFIG_RTC_DRV_PCF8563 is set or you
> wouldn't get the first part, but I think it also depends on whether
> it's built against the old or new rtc clock code.  I haven't built
> 2.6.24 in a long time, so maybe the old code is still enabled?

Good question. I even don't know if there are old or new ones...
$ ls -l rivers/rtc/rtc-pcf8563.c
-rw-r--r-- <at>  1 hns  hns   9767 26 Feb  2008 drivers/rtc/rtc-pcf8563.c

so at least 26 months old... And the first few lines reveal Version  
"0.4.2"

/*
* An I2C driver for the Philips PCF8563 RTC
* Copyright 2005-06 Tower Technologies
*
* Author: Alessandro Zummo <a.zummo@...>
* Maintainers: http://www.nslu2-linux.org/
*
* based on the other drivers in this same directory.
*
* http://www.semiconductors.philips.com/acrobat/datasheets/PCF8563-04.pdf
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/

#include <linux/i2c.h>
#include <linux/bcd.h>
#include <linux/rtc.h>

#define DRV_VERSION "0.4.2"

> I guess it depends on what code is actually there (in that version
> of the kernel) but you could try disabling either the old char
> device rtc stuff or the new rtc code and see if that helps...

I am not experienced enough to understand what you mean with "old" and  
"new code", but this are all the "RTC" configs:

$ fgrep RTC .config
# CONFIG_RTC is not set
CONFIG_RTC_PCF8563=y
# CONFIG_RTC_JZ is not set
CONFIG_RTC_LIB=y
CONFIG_RTC_CLASS=y
CONFIG_RTC_HCTOSYS=y
CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
# CONFIG_RTC_DEBUG is not set
# RTC interfaces
CONFIG_RTC_INTF_SYSFS=y
# CONFIG_RTC_INTF_PROC is not set
CONFIG_RTC_INTF_DEV=y
# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
# CONFIG_RTC_DRV_TEST is not set
# I2C RTC drivers
# CONFIG_RTC_DRV_DS1307 is not set
# CONFIG_RTC_DRV_DS1374 is not set
# CONFIG_RTC_DRV_DS1672 is not set
# CONFIG_RTC_DRV_MAX6900 is not set
# CONFIG_RTC_DRV_RS5C372 is not set
# CONFIG_RTC_DRV_ISL1208 is not set
# CONFIG_RTC_DRV_X1205 is not set
# CONFIG_RTC_DRV_PCF8563 is not set
CONFIG_RTC_DRV_PCF8583=y
# CONFIG_RTC_DRV_M41T80 is not set
# SPI RTC drivers
# Platform RTC drivers
# CONFIG_RTC_DRV_CMOS is not set
# CONFIG_RTC_DRV_DS1553 is not set
# CONFIG_RTC_DRV_STK17TA8 is not set
# CONFIG_RTC_DRV_DS1742 is not set
# CONFIG_RTC_DRV_M48T86 is not set
# CONFIG_RTC_DRV_M48T59 is not set
# CONFIG_RTC_DRV_V3020 is not set
# on-CPU RTC drivers

Hm. Finally I had an idea:

$ find /sys -name '*rtc*'
/sys/class/misc/rtc
/sys/class/rtc
/sys/module/rtc_pcf8583

So it may be as simple as changing

CONFIG_RTC_HCTOSYS_DEVICE="rtc0"

to

CONFIG_RTC_HCTOSYS_DEVICE="rtc"

I will give it a try tomorrow...

>
> Trying to move everything to a newer kernel (2.6.33_rc?) might also

I think someone had discussed a migration some time ago but support of  
the JZ4730 CPU appears to be weak in more modern kernels :(

> help, since there seems to be more and more embedded support (eg,
> OLPC hardware support is now there) in the newest mainstream kernel.

>
> Regards, Steve
>
> PS. In general, the rtc stuff seems to like being built directly
> into the kernel rather than as modules.

The RTC is an external I2C device, but the module is not a loaded one  
but directly linked into the kernel.

>
> PPS. Two other approaches to building this stuff would be:
>
> 1) Create a hardware config for bitbake (didn't someone else
> mention that at one point?)
>
> 2) Use a Gentoo-embedded ARM stage3 and build everything inside an
> image file using Qemu (or do the debian thing in Qemu).  The
> advantage of using Gentoo is full customization and the latest
> toolchain, kernel/headers and glibc/uclibc, etc.
>
> If I can ever get the time I will try the Gentoo/Qemu thing...
>
> In case anyone is interested, there are some updated ebuilds for
> qemuctl and qemu-launcher in my local overlay:
>
> http://www.gentoogeek.org/portage-overlay/app-emulation/
>
> and some (non-JZ) custom kernel ebuilds here:
>
> http://www.gentoogeek.org/portage-overlay/sys-kernel/
>
> Any patches are in the files/ dir in the ebuild directory, or on the
> Gentoo distfiles mirrors (or in http://www.gentoogeek.org/files/).
>

BR,
Nikolaus

Steve Arnold | 2 May 2010 02:10
Favicon

Re: Bootstrapping a Debian Lenny rootfs for the 2.6 kernel

On Sat, 1 May 2010 21:18:38 +0200
"Dr. H. Nikolaus Schaller" <hns@...> wrote:

> By looking into source file: this means  
> rtc_class_open(CONFIG_RTC_HCTOSYS_DEVICE) returns NULL.  
> CONFIG_RTC_HCTOSYS_DEVICE is "rtc0".

The "normal" or standard devices you should get with udev are:

lrwxrwxrwx 1 root root      4 2010-05-01 07:29 /dev/rtc -> rtc0
crw-rw---- 1 root root 254, 0 2010-05-01 07:29 /dev/rtc0

assuming you have the actual device driver(s) loaded.

So I think there are two possibilities for the rtc0 device not
showing up: 1) the i2c dependency is not being met, or 2) maybe
udev is having trouble creating the device.

> 
> $ fgrep RTC .config
> # CONFIG_RTC is not set
> CONFIG_RTC_PCF8563=y
> # CONFIG_RTC_JZ is not set
> CONFIG_RTC_LIB=y
> CONFIG_RTC_CLASS=y
> CONFIG_RTC_HCTOSYS=y
> CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
> # CONFIG_RTC_DEBUG is not set
> # RTC interfaces
> CONFIG_RTC_INTF_SYSFS=y
> # CONFIG_RTC_INTF_PROC is not set
> CONFIG_RTC_INTF_DEV=y
> # CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
> # CONFIG_RTC_DRV_TEST is not set
> # I2C RTC drivers
> # CONFIG_RTC_DRV_DS1307 is not set
> # CONFIG_RTC_DRV_DS1374 is not set
> # CONFIG_RTC_DRV_DS1672 is not set
> # CONFIG_RTC_DRV_MAX6900 is not set
> # CONFIG_RTC_DRV_RS5C372 is not set
> # CONFIG_RTC_DRV_ISL1208 is not set
> # CONFIG_RTC_DRV_X1205 is not set
> # CONFIG_RTC_DRV_PCF8563 is not set
> CONFIG_RTC_DRV_PCF8583=y
> # CONFIG_RTC_DRV_M41T80 is not set
> # SPI RTC drivers
> # Platform RTC drivers
> # CONFIG_RTC_DRV_CMOS is not set
> # CONFIG_RTC_DRV_DS1553 is not set
> # CONFIG_RTC_DRV_STK17TA8 is not set
> # CONFIG_RTC_DRV_DS1742 is not set
> # CONFIG_RTC_DRV_M48T86 is not set
> # CONFIG_RTC_DRV_M48T59 is not set
> # CONFIG_RTC_DRV_V3020 is not set
> # on-CPU RTC drivers
> 
> Hm. Finally I had an idea:
> 
> $ find /sys -name '*rtc*'
> /sys/class/misc/rtc
> /sys/class/rtc
> /sys/module/rtc_pcf8583
> 
> So it may be as simple as changing
> 
> CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
> 
> to
> 
> CONFIG_RTC_HCTOSYS_DEVICE="rtc"

It looks like you have two Phillips drivers enabled; I would
disable one of them.  Have you tried the RTC_JZ driver yet?  Or is
it just a stub? 

In general, I think the rtc0 device stuff in dmesg really depends on
what gets created under /dev rather than what you see under /sys.
If the right device appears in /sys then you should get something
under /dev (with an appropriate udev rule).

And by old and new rtc drivers I meant the (old) ones under:

Device Drivers  --->
  Character devices  --->
    Enhanced Real Time Clock Support (legacy PC RTC driver)
    Generic /dev/rtc emulation
    ...
    HPET Timer  <= this one works with both
    ...

vs. the ones under:

Device Drivers  --->
  Real Time Clock  --->
    /sys/class/rtc/rtcN (sysfs)
    /proc/driver/rtc (procfs for rtc0)
    /dev/rtcN (character devices)
    ...

The first two options under the (old) Char device section only
appear if the (newer) Real Time Clock section is disabled.  There
are lots of device-specific drivers in the latter section
(including the Phillips drivers) but not the JZ driver (at least in
the vanilla kernel).  Question: does RTC_JZ appear under the bottom
section "on-CPU RTC drivers"?

It looks to me like your "CONFIG_RTC_PCF8563=y" is an older driver,
while the newer one is dsiabled (along with the RTC_JZ driver).

What happens if you disable the first one and enable the second one?

What happens if you enable "CONFIG_RTC_DRV_PCF8563" instead?

My $.02 would be to make sure the (old) ones are disabled and only
enable stuff under the new Real Time Clock section.  Not sure about
HPET in this context; I guess you can try it both ways and see...

Here's what I get on an embedded powerpc board with an older 2.6.15
kernel and udev-079-r1 install:

lrwxrwxrwx 1 root root 8 Apr 18 13:15 /dev/rtc -> misc/rtc

so I guess the version of the kernel and/or udev is old enough that
it doesn't even create the rtc0 device (or a symlink). Do you see
anything under /sys/devices like this:

/sys/devices/pnp0/00:05/rtc
/sys/devices/pnp0/00:05/rtc/rtc0

On the above embedded board I only see this:

/sys/class/misc/rtc

Anyway, hope this helps somehow...

Steve

Dr. H. Nikolaus Schaller | 2 May 2010 13:55
Picon
Favicon

Re: Bootstrapping a Debian Lenny rootfs for the 2.6 kernel

Hi Steve,
the thread is getting longer and longer.

Am 02.05.2010 um 02:10 schrieb Steve Arnold:

> On Sat, 1 May 2010 21:18:38 +0200
> "Dr. H. Nikolaus Schaller" <hns@...> wrote:
>
>> By looking into source file: this means
>> rtc_class_open(CONFIG_RTC_HCTOSYS_DEVICE) returns NULL.
>> CONFIG_RTC_HCTOSYS_DEVICE is "rtc0".
>
> The "normal" or standard devices you should get with udev are:
>
> lrwxrwxrwx 1 root root      4 2010-05-01 07:29 /dev/rtc -> rtc0
> crw-rw---- 1 root root 254, 0 2010-05-01 07:29 /dev/rtc0

What I see is

crw-rw---- 1 root audio  10, 135 Jan  1  1970  /dev/rtc

and no link. This means that the "old" driver is active.

But this is all consistent with /sys/class/misc/rtc/dev or .../uevent

>
> assuming you have the actual device driver(s) loaded.
>
> So I think there are two possibilities for the rtc0 device not
> showing up: 1) the i2c dependency is not being met, or 2) maybe
> udev is having trouble creating the device.
>
>>
>> $ fgrep RTC .config
>> # CONFIG_RTC is not set
>> CONFIG_RTC_PCF8563=y
>> # CONFIG_RTC_JZ is not set
>> CONFIG_RTC_LIB=y
>> CONFIG_RTC_CLASS=y
>> CONFIG_RTC_HCTOSYS=y
>> CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
>> # CONFIG_RTC_DEBUG is not set
>> # RTC interfaces
>> CONFIG_RTC_INTF_SYSFS=y
>> # CONFIG_RTC_INTF_PROC is not set
>> CONFIG_RTC_INTF_DEV=y
>> # CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
>> # CONFIG_RTC_DRV_TEST is not set
>> # I2C RTC drivers
>> # CONFIG_RTC_DRV_DS1307 is not set
>> # CONFIG_RTC_DRV_DS1374 is not set
>> # CONFIG_RTC_DRV_DS1672 is not set
>> # CONFIG_RTC_DRV_MAX6900 is not set
>> # CONFIG_RTC_DRV_RS5C372 is not set
>> # CONFIG_RTC_DRV_ISL1208 is not set
>> # CONFIG_RTC_DRV_X1205 is not set
>> # CONFIG_RTC_DRV_PCF8563 is not set
>> CONFIG_RTC_DRV_PCF8583=y
>> # CONFIG_RTC_DRV_M41T80 is not set
>> # SPI RTC drivers
>> # Platform RTC drivers
>> # CONFIG_RTC_DRV_CMOS is not set
>> # CONFIG_RTC_DRV_DS1553 is not set
>> # CONFIG_RTC_DRV_STK17TA8 is not set
>> # CONFIG_RTC_DRV_DS1742 is not set
>> # CONFIG_RTC_DRV_M48T86 is not set
>> # CONFIG_RTC_DRV_M48T59 is not set
>> # CONFIG_RTC_DRV_V3020 is not set
>> # on-CPU RTC drivers
>>
>> Hm. Finally I had an idea:
>>
>> $ find /sys -name '*rtc*'
>> /sys/class/misc/rtc
>> /sys/class/rtc
>> /sys/module/rtc_pcf8583
>>
>> So it may be as simple as changing
>>
>> CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
>>
>> to
>>
>> CONFIG_RTC_HCTOSYS_DEVICE="rtc"

This was too optimistic... Does not change anything (except that "rtc"  
appears in the error message instead of "rtc0").

>
> It looks like you have two Phillips drivers enabled; I would
> disable one of them.  Have you tried the RTC_JZ driver yet?  Or is
> it just a stub?
>
> In general, I think the rtc0 device stuff in dmesg really depends on
> what gets created under /dev rather than what you see under /sys.
> If the right device appears in /sys then you should get something
> under /dev (with an appropriate udev rule).

I have compared the udev rules with an i386 lenny - it is the same

/etc/udev/rules.d/50-udev.rules (here it says SUBSYSTEM=="rtc",  
DRIVERS=="rtc_cmos", SYMLINK+="rtc")
/etc/udev/rules.d/90-permissions.rules (this is where the root:audio  
comes from)

>
> And by old and new rtc drivers I meant the (old) ones under:
>
> Device Drivers  --->
>  Character devices  --->
>    Enhanced Real Time Clock Support (legacy PC RTC driver)

this is disabled

>    Generic /dev/rtc emulation
>    ...
>    HPET Timer  <= this one works with both
>    ...

does not show up.
But there is an entry

[*] Philips PCF8563 Real Time CLock (I2C Bus)

I will try to disable this as well.

> vs. the ones under:
>
> Device Drivers  --->
>  Real Time Clock  --->
>    /sys/class/rtc/rtcN (sysfs)

[*]

>    /proc/driver/rtc (procfs for rtc0)

[ ]

>    /dev/rtcN (character devices)

[*]

>    ...

and then, I find: <*>   Philips PCF8583

Hm. I think I did read at

http://projects.kwaak.net/twiki/bin/view/Epc700/HardwareLayout

that we have an PCF8563 and not a PCF8583 inside?

>
> The first two options under the (old) Char device section only
> appear if the (newer) Real Time Clock section is disabled.  There
> are lots of device-specific drivers in the latter section
> (including the Phillips drivers) but not the JZ driver (at least in
> the vanilla kernel).  Question: does RTC_JZ appear under the bottom
> section "on-CPU RTC drivers"?

No.

>
> It looks to me like your "CONFIG_RTC_PCF8563=y" is an older driver,
> while the newer one is dsiabled (along with the RTC_JZ driver).
>
> What happens if you disable the first one and enable the second one?
>
> What happens if you enable "CONFIG_RTC_DRV_PCF8563" instead?
>
> My $.02 would be to make sure the (old) ones are disabled and only
> enable stuff under the new Real Time Clock section.  Not sure about
> HPET in this context; I guess you can try it both ways and see...
>
> Here's what I get on an embedded powerpc board with an older 2.6.15
> kernel and udev-079-r1 install:
>
> lrwxrwxrwx 1 root root 8 Apr 18 13:15 /dev/rtc -> misc/rtc
>
> so I guess the version of the kernel and/or udev is old enough that
> it doesn't even create the rtc0 device (or a symlink). Do you see
> anything under /sys/devices like this:
>
> /sys/devices/pnp0/00:05/rtc
> /sys/devices/pnp0/00:05/rtc/rtc0

No. Just usb, serial, cpu, lcd and other stuff but not rtc.

>
> On the above embedded board I only see this:
>
> /sys/class/misc/rtc

After changing the config, I find /sys/class/rtc and /sys/modules/ 
rtc_pcf8563 but they are empty.

>
>
> Anyway, hope this helps somehow...

Definitively!

But changing the config did not make it work.

I have now added some printk() to the hcttosys functions and

struct rtc_device *rtc_class_open(char *name)
{
	struct device *dev;
	struct rtc_device *rtc = NULL;
	printk(KERN_EMERG "rtc_class_open(name=%s)\n", name);

	down(&rtc_class->sem);
	list_for_each_entry(dev, &rtc_class->devices, node) {
		printk(KERN_EMERG "dev->bus_id=%s name=%s\n", dev->bus_id, name);
		if (strncmp(dev->bus_id, name, BUS_ID_SIZE) == 0) {
			dev = get_device(dev);
			if (dev)
				rtc = to_rtc_device(dev);
			break;
		}
	}

	if (rtc) {
		if (!try_module_get(rtc->owner)) {
			put_device(dev);
			rtc = NULL;
		}
	}
	up(&rtc_class->sem);

	return rtc;
}

shows that 	list_for_each_entry(dev, &rtc_class->devices, node) { }  
does not loop. I.e. the rtc_class->devices appears to be empty.

Additional printk() have shown that rtc_init is called, the  
class_create() is successful and both rtc_sysfs_init() and  
rtc_dev_init() are called. Both are included in the .config. Disabling  
the CONFIG_RTC_INTF_DEV had no visible effect (except removing my  
printk message).

So, something is wrong with the initialization of these kernel  
structures. So the question is where rtc_class->devices should be  
initialized/populated.

Finally I have studied http://www.mjmwired.net/kernel/Documentation/rtc.txt 
  and accodting to that document /sys/class/rtc should not be an empty  
directory but show rtc0...

BR,
Nikolaus

Dr. H. Nikolaus Schaller | 3 May 2010 16:32
Picon
Favicon

Re: 2.6-Kernel: RTC not working - may be that I2C is not working?

After more and more experimenting I now tried this config:

$ fgrep I2C kernel/.config
CONFIG_I2C=y
CONFIG_I2C_BOARDINFO=y
CONFIG_I2C_CHARDEV=m
# I2C Algorithms
# CONFIG_I2C_ALGOBIT is not set
# CONFIG_I2C_ALGOPCF is not set
# CONFIG_I2C_ALGOPCA is not set
# I2C Hardware Bus support
# CONFIG_I2C_OCORES is not set
# CONFIG_I2C_PARPORT_LIGHT is not set
# CONFIG_I2C_SIMTEC is not set
# CONFIG_I2C_TAOS_EVM is not set
# CONFIG_I2C_STUB is not set
# CONFIG_I2C_TINY_USB is not set
# Miscellaneous I2C Chip support
CONFIG_I2C_DEBUG_CORE=y
CONFIG_I2C_DEBUG_ALGO=y
CONFIG_I2C_DEBUG_BUS=y
CONFIG_I2C_DEBUG_CHIP=y

There is no I2C algoritm enabled and no Hardware Bus support.
With that the only i2c related messages I see in dmesg:

i2c-core: driver [pcf8563] registered
i2c-core: driver [pcf8583] registered

and the

Write I2C device 0x13 failed.

Finally,

/sys/bus/i2c/devices

exists but is completely empty.

Finally, i2cdump reports:

Error: No I2C busses found!

So I now think that the I2C chip driver is not working or not enabled.

Does anyone know where to look for this? How does the JZ4730 I2C  
interface work? Do we need to do some board-configuration for  
initialization/registration?

BR,
Nikolaus

Am 02.05.2010 um 13:55 schrieb Dr. H. Nikolaus Schaller:

> Hi Steve,
> the thread is getting longer and longer.
>
> Am 02.05.2010 um 02:10 schrieb Steve Arnold:
>
>> On Sat, 1 May 2010 21:18:38 +0200
>> "Dr. H. Nikolaus Schaller" <hns@...> wrote:
>>
>>> By looking into source file: this means
>>> rtc_class_open(CONFIG_RTC_HCTOSYS_DEVICE) returns NULL.
>>> CONFIG_RTC_HCTOSYS_DEVICE is "rtc0".
>>
>> The "normal" or standard devices you should get with udev are:
>>
>> lrwxrwxrwx 1 root root      4 2010-05-01 07:29 /dev/rtc -> rtc0
>> crw-rw---- 1 root root 254, 0 2010-05-01 07:29 /dev/rtc0
>
> What I see is
>
> crw-rw---- 1 root audio  10, 135 Jan  1  1970  /dev/rtc
>
> and no link. This means that the "old" driver is active.
>
> But this is all consistent with /sys/class/misc/rtc/dev or .../uevent
>
>>
>> assuming you have the actual device driver(s) loaded.
>>
>> So I think there are two possibilities for the rtc0 device not
>> showing up: 1) the i2c dependency is not being met, or 2) maybe
>> udev is having trouble creating the device.
>>
>>>
>>> $ fgrep RTC .config
>>> # CONFIG_RTC is not set
>>> CONFIG_RTC_PCF8563=y
>>> # CONFIG_RTC_JZ is not set
>>> CONFIG_RTC_LIB=y
>>> CONFIG_RTC_CLASS=y
>>> CONFIG_RTC_HCTOSYS=y
>>> CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
>>> # CONFIG_RTC_DEBUG is not set
>>> # RTC interfaces
>>> CONFIG_RTC_INTF_SYSFS=y
>>> # CONFIG_RTC_INTF_PROC is not set
>>> CONFIG_RTC_INTF_DEV=y
>>> # CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
>>> # CONFIG_RTC_DRV_TEST is not set
>>> # I2C RTC drivers
>>> # CONFIG_RTC_DRV_DS1307 is not set
>>> # CONFIG_RTC_DRV_DS1374 is not set
>>> # CONFIG_RTC_DRV_DS1672 is not set
>>> # CONFIG_RTC_DRV_MAX6900 is not set
>>> # CONFIG_RTC_DRV_RS5C372 is not set
>>> # CONFIG_RTC_DRV_ISL1208 is not set
>>> # CONFIG_RTC_DRV_X1205 is not set
>>> # CONFIG_RTC_DRV_PCF8563 is not set
>>> CONFIG_RTC_DRV_PCF8583=y
>>> # CONFIG_RTC_DRV_M41T80 is not set
>>> # SPI RTC drivers
>>> # Platform RTC drivers
>>> # CONFIG_RTC_DRV_CMOS is not set
>>> # CONFIG_RTC_DRV_DS1553 is not set
>>> # CONFIG_RTC_DRV_STK17TA8 is not set
>>> # CONFIG_RTC_DRV_DS1742 is not set
>>> # CONFIG_RTC_DRV_M48T86 is not set
>>> # CONFIG_RTC_DRV_M48T59 is not set
>>> # CONFIG_RTC_DRV_V3020 is not set
>>> # on-CPU RTC drivers
>>>
>>> Hm. Finally I had an idea:
>>>
>>> $ find /sys -name '*rtc*'
>>> /sys/class/misc/rtc
>>> /sys/class/rtc
>>> /sys/module/rtc_pcf8583
>>>
>>> So it may be as simple as changing
>>>
>>> CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
>>>
>>> to
>>>
>>> CONFIG_RTC_HCTOSYS_DEVICE="rtc"
>
> This was too optimistic... Does not change anything (except that  
> "rtc" appears in the error message instead of "rtc0").
>
>>
>> It looks like you have two Phillips drivers enabled; I would
>> disable one of them.  Have you tried the RTC_JZ driver yet?  Or is
>> it just a stub?
>>
>> In general, I think the rtc0 device stuff in dmesg really depends on
>> what gets created under /dev rather than what you see under /sys.
>> If the right device appears in /sys then you should get something
>> under /dev (with an appropriate udev rule).
>
> I have compared the udev rules with an i386 lenny - it is the same
>
> /etc/udev/rules.d/50-udev.rules (here it says SUBSYSTEM=="rtc",  
> DRIVERS=="rtc_cmos", SYMLINK+="rtc")
> /etc/udev/rules.d/90-permissions.rules (this is where the root:audio  
> comes from)
>
>>
>> And by old and new rtc drivers I meant the (old) ones under:
>>
>> Device Drivers  --->
>> Character devices  --->
>>  Enhanced Real Time Clock Support (legacy PC RTC driver)
>
> this is disabled
>
>>  Generic /dev/rtc emulation
>>  ...
>>  HPET Timer  <= this one works with both
>>  ...
>
> does not show up.
> But there is an entry
>
> [*] Philips PCF8563 Real Time CLock (I2C Bus)
>
> I will try to disable this as well.
>
>> vs. the ones under:
>>
>> Device Drivers  --->
>> Real Time Clock  --->
>>  /sys/class/rtc/rtcN (sysfs)
>
> [*]
>
>>  /proc/driver/rtc (procfs for rtc0)
>
> [ ]
>
>>  /dev/rtcN (character devices)
>
> [*]
>
>>  ...
>
> and then, I find: <*>   Philips PCF8583
>
> Hm. I think I did read at
>
> http://projects.kwaak.net/twiki/bin/view/Epc700/HardwareLayout
>
> that we have an PCF8563 and not a PCF8583 inside?
>
>>
>> The first two options under the (old) Char device section only
>> appear if the (newer) Real Time Clock section is disabled.  There
>> are lots of device-specific drivers in the latter section
>> (including the Phillips drivers) but not the JZ driver (at least in
>> the vanilla kernel).  Question: does RTC_JZ appear under the bottom
>> section "on-CPU RTC drivers"?
>
> No.
>
>>
>> It looks to me like your "CONFIG_RTC_PCF8563=y" is an older driver,
>> while the newer one is dsiabled (along with the RTC_JZ driver).
>>
>> What happens if you disable the first one and enable the second one?
>>
>> What happens if you enable "CONFIG_RTC_DRV_PCF8563" instead?
>>
>> My $.02 would be to make sure the (old) ones are disabled and only
>> enable stuff under the new Real Time Clock section.  Not sure about
>> HPET in this context; I guess you can try it both ways and see...
>>
>> Here's what I get on an embedded powerpc board with an older 2.6.15
>> kernel and udev-079-r1 install:
>>
>> lrwxrwxrwx 1 root root 8 Apr 18 13:15 /dev/rtc -> misc/rtc
>>
>> so I guess the version of the kernel and/or udev is old enough that
>> it doesn't even create the rtc0 device (or a symlink). Do you see
>> anything under /sys/devices like this:
>>
>> /sys/devices/pnp0/00:05/rtc
>> /sys/devices/pnp0/00:05/rtc/rtc0
>
> No. Just usb, serial, cpu, lcd and other stuff but not rtc.
>
>>
>> On the above embedded board I only see this:
>>
>> /sys/class/misc/rtc
>
> After changing the config, I find /sys/class/rtc and /sys/modules/ 
> rtc_pcf8563 but they are empty.
>
>>
>>
>> Anyway, hope this helps somehow...
>
> Definitively!
>
> But changing the config did not make it work.
>
> I have now added some printk() to the hcttosys functions and
>
> struct rtc_device *rtc_class_open(char *name)
> {
> 	struct device *dev;
> 	struct rtc_device *rtc = NULL;
> 	printk(KERN_EMERG "rtc_class_open(name=%s)\n", name);
>
> 	down(&rtc_class->sem);
> 	list_for_each_entry(dev, &rtc_class->devices, node) {
> 		printk(KERN_EMERG "dev->bus_id=%s name=%s\n", dev->bus_id, name);
> 		if (strncmp(dev->bus_id, name, BUS_ID_SIZE) == 0) {
> 			dev = get_device(dev);
> 			if (dev)
> 				rtc = to_rtc_device(dev);
> 			break;
> 		}
> 	}
>
> 	if (rtc) {
> 		if (!try_module_get(rtc->owner)) {
> 			put_device(dev);
> 			rtc = NULL;
> 		}
> 	}
> 	up(&rtc_class->sem);
>
> 	return rtc;
> }
>
> shows that 	list_for_each_entry(dev, &rtc_class->devices, node) { }  
> does not loop. I.e. the rtc_class->devices appears to be empty.
>
> Additional printk() have shown that rtc_init is called, the  
> class_create() is successful and both rtc_sysfs_init() and  
> rtc_dev_init() are called. Both are included in the .config.  
> Disabling the CONFIG_RTC_INTF_DEV had no visible effect (except  
> removing my printk message).
>
> So, something is wrong with the initialization of these kernel  
> structures. So the question is where rtc_class->devices should be  
> initialized/populated.
>
> Finally I have studied http://www.mjmwired.net/kernel/Documentation/rtc.txt 
>  and accodting to that document /sys/class/rtc should not be an  
> empty directory but show rtc0...
>
> BR,
> Nikolaus
>
> _______________________________________________
> Mipsbook-devel mailing list
> Mipsbook-devel@...
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/mipsbook-devel

Riccardo Mottola | 3 May 2010 17:12
Picon
Gravatar

Re: 2.6-Kernel: RTC not working - may be that I2C is not working?

Hi,

On Mon, May 3, 2010 at 4:32 PM, Dr. H. Nikolaus Schaller <hns-bdq14YP6qtRg9hUCZPvPmw@public.gmane.org> wrote:
After more and more experimenting I now tried this config:

$ fgrep I2C kernel/.config
CONFIG_I2C=y
CONFIG_I2C_BOARDINFO=y
CONFIG_I2C_CHARDEV=m
# I2C Algorithms
# CONFIG_I2C_ALGOBIT is not set
# CONFIG_I2C_ALGOPCF is not set
# CONFIG_I2C_ALGOPCA is not set
# I2C Hardware Bus support
# CONFIG_I2C_OCORES is not set
# CONFIG_I2C_PARPORT_LIGHT is not set
# CONFIG_I2C_SIMTEC is not set
# CONFIG_I2C_TAOS_EVM is not set
# CONFIG_I2C_STUB is not set
# CONFIG_I2C_TINY_USB is not set
# Miscellaneous I2C Chip support
CONFIG_I2C_DEBUG_CORE=y
CONFIG_I2C_DEBUG_ALGO=y
CONFIG_I2C_DEBUG_BUS=y
CONFIG_I2C_DEBUG_CHIP=y

There is no I2C algoritm enabled and no Hardware Bus support.
With that the only i2c related messages I see in dmesg:

i2c-core: driver [pcf8563] registered
i2c-core: driver [pcf8583] registered

and the

Write I2C device 0x13 failed.

Finally,

/sys/bus/i2c/devices

exists but is completely empty.

Finally, i2cdump reports:

Error: No I2C busses found!

So I now think that the I2C chip driver is not working or not enabled.

 Does anyone know where to look for this? How does the JZ4730 I2C interface work? Do we need to do some board-configuration for initialization/registration

Apparently the 2.4 kernel is setup up quite differently.

the only RTC line I see is (verbatim):

PCF8563 RTC installed !!!

there are no i2c or I2C lines in dmesg,

only I2S is mentioned, which is for sound and not clocks :)

Riccardo

 
<div>
<p>Hi,<br><br></p>
<div class="gmail_quote">On Mon, May 3, 2010 at 4:32 PM, Dr. H. Nikolaus Schaller <span dir="ltr">&lt;<a href="mailto:hns@...g">hns@...</a>&gt;</span> wrote:<br><blockquote class="gmail_quote">
After more and more experimenting I now tried this config:<br><br>
$ fgrep I2C kernel/.config<br>
CONFIG_I2C=y<br>
CONFIG_I2C_BOARDINFO=y<br>
CONFIG_I2C_CHARDEV=m<br>
# I2C Algorithms<br>
# CONFIG_I2C_ALGOBIT is not set<br>
# CONFIG_I2C_ALGOPCF is not set<br>
# CONFIG_I2C_ALGOPCA is not set<br>
# I2C Hardware Bus support<br>
# CONFIG_I2C_OCORES is not set<br>
# CONFIG_I2C_PARPORT_LIGHT is not set<br>
# CONFIG_I2C_SIMTEC is not set<br>
# CONFIG_I2C_TAOS_EVM is not set<br>
# CONFIG_I2C_STUB is not set<br>
# CONFIG_I2C_TINY_USB is not set<br>
# Miscellaneous I2C Chip support<br>
CONFIG_I2C_DEBUG_CORE=y<br>
CONFIG_I2C_DEBUG_ALGO=y<br>
CONFIG_I2C_DEBUG_BUS=y<br>
CONFIG_I2C_DEBUG_CHIP=y<br><br>
There is no I2C algoritm enabled and no Hardware Bus support.<br>
With that the only i2c related messages I see in dmesg:<br><br>
i2c-core: driver [pcf8563] registered<br>
i2c-core: driver [pcf8583] registered<br><br>
and the<br><br>
Write I2C device 0x13 failed.<br><br>
Finally,<br><br>
/sys/bus/i2c/devices<br><br>
exists but is completely empty.<br><br>
Finally, i2cdump reports:<br><br>
Error: No I2C busses found!<br><br>
So I now think that the I2C chip driver is not working or not enabled.<br><br>&nbsp;Does anyone know where to look for this? How does the JZ4730 I2C interface work? Do we need to do some board-configuration for initialization/registration<br>
</blockquote>
<div><br></div>
<div>Apparently the 2.4 kernel is setup up quite differently.</div>
<div><br></div>
<div>the only RTC line I see is (verbatim):</div>
<div><br></div>
<div>PCF8563 RTC installed !!!<br>
</div>
<div><br></div>
<div>there are no i2c or I2C lines in dmesg,</div>
<div><br></div>
<div>only I2S is mentioned, which is for sound and not clocks :)</div>
<div><br></div>
<div>Riccardo</div>
<div>
<br>&nbsp;</div>
</div>
</div>
Dr. H. Nikolaus Schaller | 3 May 2010 17:16
Picon
Favicon

Re: 2.6-Kernel: RTC not working - may be that I2C is not working?

Hi Riccardo,

 Does anyone know where to look for this? How does the JZ4730 I2C interface work? Do we need to do some board-configuration for initialization/registration

Apparently the 2.4 kernel is setup up quite differently.

Yes, I2C management has been changed largely from 2.4 to 2.6. Here is some general reference:


BR,
Nikolaus 

<div>Hi Riccardo,<div>
<div>
<blockquote type="cite"><div class="gmail_quote">
<blockquote class="gmail_quote">
<br>&nbsp;Does anyone know where to look for this? How does the JZ4730 I2C interface work? Do we need to do some board-configuration for initialization/registration<br>
</blockquote>
<div><br></div>
<div>Apparently the 2.4 kernel is setup up quite differently.</div>
</div></blockquote>
<div><br></div>Yes, I2C management has been changed largely from 2.4 to 2.6. Here is some general reference:</div>
<div><br></div>
<div><a href="http://www.linuxjournal.com/article/7136">http://www.linuxjournal.com/article/7136</a></div>
<div><br></div>
<div>BR,</div>
<div>Nikolaus&nbsp;</div>
<br>
</div>
</div>
Dr. H. Nikolaus Schaller | 3 May 2010 18:12
Picon
Favicon

Re: 2.6-Kernel: RTC not working - may be that I2C is not working?

>  Does anyone know where to look for this? How does the JZ4730 I2C  
> interface work? Do we need to do some board-configuration for  
> initialization/registration

I found another hint. There is a i2c.c file in arch/mips/jz4730. I  
will add some debugging to it :)

Dr. H. Nikolaus Schaller | 3 May 2010 21:35
Picon
Favicon

Re: 2.6-Kernel: RTC not working - may be that I2C is not working?

Hi Ruben,
please add the list to CC: or otherwise others will loose important information (maybe the moderators could change the reply-to?)...

Am 03.05.2010 um 20:36 schrieb Ruben Viets:

Hi Nikolaus,
 
In my compiled kernel The rtc problem is a minor issue, just that the kernel cannot reset the hwclock.
If I disable CONFIG_RTC_HCTOSYS, I can get rid of the error during kernel startup, linux script will set the hwclock right during start.

Well, switching off error messages is also a solution :) But, unless one has ntp and internet service, a working RTC would be a nice feature.

 
If you run hwclock --hctosys script from linux. You will see the rtc is running ok or not.

Ah, ok. Would be a manual workaround.

If it's not, check /dev/rtc . 
If there is not a /dev/rtc add it with 
#mknod /dev/rtc c 10 135
 and add rw for all users with
 #chmod 666 rtc 
 
The I2C issue could also be related to the wrong configs for sound.ak4642en.c and jz_i2s.c. 
If you didn't modify the sources this will never work. These files need a full rewriting if you want to get sound working. there are a lot conflicts/warnings with 'dangerous' function calls etc..... still they can partly work, but will never be stable in kernel 2.6.24.3.

I also think it has something to do with I2C. What I have found is some work by Qi-Hardware for the JZ4740/4750 and they have written/modified a I2C bus driver. I have tried to port it (needs some obvious minor tweaking) but is also not installed/probed/loaded/used. Maybe they can help. Therefore, I will ask on their mailing list.

Debugging has only shown the the I2C error for address 0x13 comes right after calling i2c_open() from file arch/mips/jz4730/i2c.c 

The unknown question is what this device is... Since i2c-tools don't work it is difficult to identify...

So it appears that there are multiple I2C drivers available. Perhaps "old" and "new" style.

The interesting experiment was to re-enable the Drivers/Character/pcf driver. And now I see tens of successful i2c_open() calls! And, hwclock --hctosys works. And, the write to 0x13 error is reduced (but not completely removed). hwclock --show also works.

What has changed now is that I have a /sys/class/misc/rtc (which appears to create the /dev/rtc) AND a /sys/class/rtc (which is empty)

So what can we learn? I think I should look into the sources of the old RTC driver to find out what it is doing differently (with respect to initialization, e.g. GPIO assignment?).


Thanks! I have started my own git server for the kernel sources and will publish details (togetter with the Lenny 400 rootfs) as soon as I have some progress. Then, one can easily create branches that have sound enabled/disabled and include your patches. And different versions of the rootfs without starting from scratch.

Another question regarding the touch buttons: to your knowledge, is there already a stub driver that simply does not work or has it to be written from scratch? Or can we integrate this into the keyboard driver?

BR,
Nikolaus

 
You can use them on your own risk ;-) Or you just disable the sound section in the kernel.
 
Grt Ruben.
 
Date: Mon, 3 May 2010 17:12:55 +0200
From: multix-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
To: hns-bdq14YP6qtRg9hUCZPvPmw@public.gmane.org
CC: mipsbook-devel-CQP9ExgZy9rrZ44/DZwexQ@public.gmane.org
Subject: Re: [Mipsbook-devel] 2.6-Kernel: RTC not working - may be that I2C is not working?

Hi,

On Mon, May 3, 2010 at 4:32 PM, Dr. H. Nikolaus Schaller <hns-bdq14YP6qtRg9hUCZPvPmw@public.gmane.org> wrote:
After more and more experimenting I now tried this config:

$ fgrep I2C kernel/.config
CONFIG_I2C=y
CONFIG_I2C_BOARDINFO=y
CONFIG_I2C_CHARDEV=m
# I2C Algorithms
# CONFIG_I2C_ALGOBIT is not set
# CONFIG_I2C_ALGOPCF is not set
# CONFIG_I2C_ALGOPCA is not set
# I2C Hardware Bus support
# CONFIG_I2C_OCORES is not set
# CONFIG_I2C_PARPORT_LIGHT is not set
# CONFIG_I2C_SIMTEC is not set
# CONFIG_I2C_TAOS_EVM is not set
# CONFIG_I2C_STUB is not set
# CONFIG_I2C_TINY_USB is not set
# Miscellaneous I2C Chip support
CONFIG_I2C_DEBUG_CORE=y
CONFIG_I2C_DEBUG_ALGO=y
CONFIG_I2C_DEBUG_BUS=y
CONFIG_I2C_DEBUG_CHIP=y

There is no I2C algoritm enabled and no Hardware Bus support.
With that the only i2c related messages I see in dmesg:

i2c-core: driver [pcf8563] registered
i2c-core: driver [pcf8583] registered

and the

Write I2C device 0x13 failed.

Finally,

/sys/bus/i2c/devices

exists but is completely empty.

Finally, i2cdump reports:

Error: No I2C busses found!

So I now think that the I2C chip driver is not working or not enabled.

 Does anyone know where to look for this? How does the JZ4730 I2C interface work? Do we need to do some board-configuration for initialization/registration

Apparently the 2.4 kernel is setup up quite differently.

the only RTC line I see is (verbatim):

PCF8563 RTC installed !!!

there are no i2c or I2C lines in dmesg,

only I2S is mentioned, which is for sound and not clocks :)

Riccardo

 

New Windows 7: Find the right PC for you. Learn more.

<div>Hi Ruben,<div>please add the list to CC: or otherwise others will loose important information (maybe the moderators could change the reply-to?)...<br><div><br></div>
<div>
<div>
<div>Am 03.05.2010 um 20:36 schrieb Ruben Viets:</div>
<br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span"><div class="hmmessage">Hi&nbsp;Nikolaus,<br>&nbsp;<br>In my compiled kernel The rtc problem is a minor issue, just that the kernel cannot reset the hwclock.<br>If&nbsp;I disable CONFIG_RTC_HCTOSYS,&nbsp;I can&nbsp;get rid of the error during kernel startup, linux script will set the hwclock right during start.<br>
</div></span></blockquote>
<div><br></div>Well, switching off error messages is also a solution :) But, unless one has ntp and internet service, a working RTC would be a nice feature.</div>
<div>
<br><blockquote type="cite"><span class="Apple-style-span"><div class="hmmessage">&nbsp;<br>If you run&nbsp;hwclock --hctosys&nbsp;script from linux. You will see the rtc is running ok or not.<br>
</div></span></blockquote>
<div><br></div>Ah, ok. Would be a manual workaround.</div>
<div>
<br><blockquote type="cite"><span class="Apple-style-span"><div class="hmmessage">If it's not,&nbsp;check /dev/rtc .<span class="Apple-converted-space">&nbsp;</span><br>If there is not&nbsp;a&nbsp;/dev/rtc&nbsp;add it with<span class="Apple-converted-space">&nbsp;</span><br>#mknod /dev/rtc c 10 135<br>&nbsp;and add rw for all users&nbsp;with<br>&nbsp;#chmod 666 rtc&nbsp;</div></span></blockquote>
</div>
<div>
<blockquote type="cite"><span class="Apple-style-span"><div class="hmmessage">&nbsp;<br>The I2C issue could also&nbsp;be related to the wrong configs for sound.ak4642en.c and jz_i2s.c.&nbsp;<br>If you didn't modify the sources&nbsp;this will&nbsp;never work. These files need a full rewriting if you want to&nbsp;get sound working.&nbsp;there are a lot conflicts/warnings with 'dangerous' function calls etc..... still they can partly work, but will never be stable in kernel 2.6.24.3.<br>
</div></span></blockquote>
<div><br></div>I also think it has something to do with I2C. What I have found is some work by Qi-Hardware for the JZ4740/4750 and they have written/modified a I2C bus driver. I have tried to port it (needs some obvious minor tweaking) but is also not installed/probed/loaded/used. Maybe they can help. Therefore, I will ask on their mailing list.</div>
<div><br></div>
<div>Debugging has only shown the the I2C error for address 0x13 comes right after calling&nbsp;<span class="Apple-style-span">i2c_open()</span><span class="Apple-style-span"> from file arch/mips/jz4730/i2c.c&nbsp;</span>
</div>
<div><br></div>
<div>The unknown question is what this device is... Since i2c-tools don't work it is difficult to identify...</div>
<div><span class="Apple-style-span"><br></span></div>
<div>So it appears that there are multiple I2C drivers available. Perhaps "old" and "new" style.</div>
<div><br></div>
<div>The interesting experiment was to re-enable the Drivers/Character/pcf driver. And now I see tens of successful&nbsp;<span class="Apple-style-span">i2c_open()&nbsp;<span class="Apple-style-span">calls! And, hwclock&nbsp;<span class="Apple-style-span">--hctosys&nbsp;<span class="Apple-style-span">works. And, the write to 0x13 error is reduced (but not completely removed). hwclock --show also works.</span></span></span></span>
</div>
<div><br></div>
<div>What has changed now is that I have a /sys/class/misc/rtc (which appears to create the /dev/rtc) AND a /sys/class/rtc (which is empty)</div>
<div><br></div>
<div>So what can we learn? I think I should look into the sources of the old RTC driver to find out what it is doing differently (with respect to initialization, e.g. GPIO assignment?).</div>
<div><br></div>
<div>
<blockquote type="cite"><div class="hmmessage">&nbsp;<br>I quickly copied pasted some parts of these files and uploaded here:&nbsp;<br><a href="https://projects.kwaak.net/twiki/pub/Epc700/KernelPort26Compiling/ak4642en.c">https://projects.kwaak.net/twiki/pub/Epc700/KernelPort26Compiling/ak4642en.c</a><br><a href="https://projects.kwaak.net/twiki/pub/Epc700/KernelPort26Compiling/jz_i2s.c">https://projects.kwaak.net/twiki/pub/Epc700/KernelPort26Compiling/jz_i2s.c</a><br>
</div></blockquote>
<div><br></div>Thanks! I have started my own git server for the kernel sources and will publish details (togetter with the Lenny 400 rootfs) as soon as I have some progress. Then, one can easily create branches that have sound enabled/disabled and include your patches. And different versions of the rootfs without starting from scratch.</div>
<div><br></div>
<div>Another question regarding the touch buttons: to your knowledge, is there already a stub driver that simply does not work or has it to be written from scratch? Or can we integrate this into the keyboard driver?</div>
<div><br></div>
<div>BR,</div>
<div>Nikolaus</div>
<div>
<br><blockquote type="cite"><div class="hmmessage">&nbsp;<br>You can use them on your own risk ;-) Or&nbsp;you just disable the sound section in the kernel.<br>&nbsp;<br>Grt Ruben.<br>&nbsp;<br>Date: Mon, 3 May 2010 17:12:55 +0200<br>From:<span class="Apple-converted-space">&nbsp;</span><a href="mailto:multix@...">multix@...</a><br>To:<span class="Apple-converted-space">&nbsp;</span><a href="mailto:hns@...">hns@...</a><br>CC:<span class="Apple-converted-space">&nbsp;</span><a href="mailto:mipsbook-devel@...">mipsbook-devel@...</a><br>Subject: Re: [Mipsbook-devel] 2.6-Kernel: RTC not working - may be that I2C is not working?<br><br>Hi,<br><br><div class="ecxgmail_quote">On Mon, May 3, 2010 at 4:32 PM, Dr. H. Nikolaus Schaller<span class="Apple-converted-space">&nbsp;</span><span dir="ltr">&lt;<a href="mailto:hns@...">hns@...</a>&gt;</span><span class="Apple-converted-space">&nbsp;</span>wrote:<br><blockquote class="ecxgmail_quote">After more and more experimenting I now tried this config:<br><br>$ fgrep I2C kernel/.config<br>CONFIG_I2C=y<br>CONFIG_I2C_BOARDINFO=y<br>CONFIG_I2C_CHARDEV=m<br># I2C Algorithms<br># CONFIG_I2C_ALGOBIT is not set<br># CONFIG_I2C_ALGOPCF is not set<br># CONFIG_I2C_ALGOPCA is not set<br># I2C Hardware Bus support<br># CONFIG_I2C_OCORES is not set<br># CONFIG_I2C_PARPORT_LIGHT is not set<br># CONFIG_I2C_SIMTEC is not set<br># CONFIG_I2C_TAOS_EVM is not set<br># CONFIG_I2C_STUB is not set<br># CONFIG_I2C_TINY_USB is not set<br># Miscellaneous I2C Chip support<br>CONFIG_I2C_DEBUG_CORE=y<br>CONFIG_I2C_DEBUG_ALGO=y<br>CONFIG_I2C_DEBUG_BUS=y<br>CONFIG_I2C_DEBUG_CHIP=y<br><br>There is no I2C algoritm enabled and no Hardware Bus support.<br>With that the only i2c related messages I see in dmesg:<br><br>i2c-core: driver [pcf8563] registered<br>i2c-core: driver [pcf8583] registered<br><br>and the<br><br>Write I2C device 0x13 failed.<br><br>Finally,<br><br>/sys/bus/i2c/devices<br><br>exists but is completely empty.<br><br>Finally, i2cdump reports:<br><br>Error: No I2C busses found!<br><br>So I now think that the I2C chip driver is not working or not enabled.<br><br>&nbsp;Does anyone know where to look for this? How does the JZ4730 I2C interface work? Do we need to do some board-configuration for initialization/registration<br>
</blockquote>
<div><br></div>
<div>Apparently the 2.4 kernel is setup up quite differently.</div>
<div><br></div>
<div>the only RTC line I see is (verbatim):</div>
<div><br></div>
<div>PCF8563 RTC installed !!!<br>
</div>
<div><br></div>
<div>there are no i2c or I2C lines in dmesg,</div>
<div><br></div>
<div>only I2S is mentioned, which is for sound and not clocks :)</div>
<div><br></div>
<div>Riccardo</div>
<div>
<br>&nbsp;</div>
</div>
<br>New Windows 7: Find the right PC for you.<span class="Apple-converted-space">&nbsp;</span><a href="http://windows.microsoft.com/shop" target="_new">Learn more.</a>
</div></blockquote>
</div>
<br>
</div>
</div>
</div>

Gmane