All of lore.kernel.org
 help / color / mirror / Atom feed
From: be.terawatt@laposte.net (Matthieu TORRES)
To: lm-sensors@vger.kernel.org
Subject: [lm-sensors] RTC + DS1337
Date: Thu, 29 Jun 2006 07:06:54 +0000	[thread overview]
Message-ID: <44A37C0E.3090604@laposte.net> (raw)

Hi,

I faced a problem with DS1337 RTC.  I use a pxa255 cpu with 2.6.16 
kernel. I tried to make a DS1339 chip (real time clock) working with 
hwclock.
In my config, I selected I2C, DS1337/DS1339 driver, and ehanced RTC 
support to have it working with /dev/rtc as expected by hwclock. That is 
to say the following options:

CONFIG_RTC=y
CONFIG_I2C=y
CONFIG_I2C_PXA=y
CONFIG_SENSORS_DS1337=y

The ioctl() to dev/rtc did not work. While investaigating on that issue, 
I found 2 problems :

- the option "Enhanced Real Time Clock Support" (config RTC)  does not 
provide generic access to a RTC chip via /dev/rtc as I belevied. The 
access to the chip in driver/char/rtc.c are made with CMOS_READ() and 
CMOS_WRITE(),  defined in Linux/include/asm-arm/mc146818rtc.h. It is a 
combination of outb_p() and inb_p() : no chance to access my I2C chip 
that way...
So I added ioct() support in /drivers/i2c/chips/ds1337.c.

- the driver (/drivers/i2c/chips/ds1337.c) has two problems (I'm not 
sure it is bugs, but at least on my system it does not work).
First, ds1337_detect() reads some values in the chip registers that are 
assumed to be wrong, but in my chip they do exist (I swear I have a 
DS1339). I commented out these checks.
Then, the part that enables the RTC after first power up in 
ds1337_init_client() fails to write a status bit in the chip, so we fall 
into the same reset code (that writes zeros in the RTC regs) after each 
reboot.
I corrected this and that's OK for me.

I can post code if it is usefull for someone.



             reply	other threads:[~2006-06-29  7:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-29  7:06 Matthieu TORRES [this message]
2006-06-29  9:43 ` [lm-sensors] RTC + DS1337 Michael Burian
2006-06-29 10:06 ` Rudolf Marek
2006-06-29 11:34 ` Ben Dooks
2006-06-30  8:03 ` [lm-sensors] [i2c] " James Chapman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=44A37C0E.3090604@laposte.net \
    --to=be.terawatt@laposte.net \
    --cc=lm-sensors@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.