2008-10-01 12:51:47

by Bosko Radivojevic

[permalink] [raw]
Subject: Re: [PATCH] add support for ST M41T94 SPI RTC (patch rev. 3)

[ I sent a few private messages to Kim, but I'll sumarize my problem here ]

Hi all,

I have AT91SAM9260-based board, kernel is 2.6.26.3. M41T94 is
connected on SPI channel 1, chip select 0. I've applied Kim's patch
and added SPI device in board-sam9260ek.c:
#if defined(CONFIG_RTC_DRV_M41T94) || defined(CONFIG_RTC_DRV_M41T94_MODULE)
{ /* External RTC */
.modalias = "rtc-m41t94",
.chip_select = 0,
.max_speed_hz = 2 * 1000 * 1000,
.bus_num = 1,
},
#endif

During booting up everything seems fine (M41T94 is found etc), but it
is not working. Here is some output:

rtc-m41t94: dev (254:0)
rtc-m41t94 spi1.0: rtc core: registered rtc-m41t94 as rtc0
rtc-m41t94 spi1.0: read secs=0, mins=0, hours=0, mday=0, mon=-1,
year=100, wday=-1
rtc-m41t94 spi1.0: hctosys: unable to read the hardware clock
[..]
# hwclock -r;dmesg
hwclock: RTC_RD_TIME: Invalid argument
rtc-m41t94 spi1.0: read secs=0, mins=0, hours=0, mday=0, mon=-1,
year=100, wday=-1

#hwclock -w;dmesg
rtc-m41t94 spi1.0: write secs=15, mins=0, hours=0, mday=1, mon=0,
year=70, wday=4

I've tried both SPIMODE0 and SPIMODE3 (according to m41t94 datasheet)
but no improvements.

Thanks


2008-10-02 17:33:54

by Kim B. Heino

[permalink] [raw]
Subject: Re: [PATCH] add support for ST M41T94 SPI RTC (patch rev. 3)

> I have AT91SAM9260-based board, kernel is 2.6.26.3.

I'm using my RTC-patch with the same CPU. Custom AT91SAM9260 board,
external RTC because of AT's errata...

> M41T94 is connected on SPI channel 1, chip select 0. I've applied
> Kim's patch and added SPI device in board-sam9260ek.c

> { /* External RTC */
> .modalias = "rtc-m41t94",
> .chip_select = 0,
> .max_speed_hz = 2 * 1000 * 1000,
> .bus_num = 1,
> },

I'm using it with ".max_speed_hz = 1 * 1000 * 1000," instead of 2 MHz.
Can you try with slower speed? My patch (rev 3) and this small
ek_spi_devices[] modification should be enough.

I have it on bus = 0, chip_select = 1, so I've also removed dataflash
parts from ek_spi_devices[] (we're using NOR flash). But for you this
is not needed.

I also have a patch to add support for M41T94's watchdog timer. It's
not clean enough to be submitted upstreams yet. If you need it I can
email it to you.