Subject: Re: TS-219 RTC issue with Debian Buster

From: Russell King - ARM Linux admin <[email-masked]>
Date: Tue, 23 Jul 2019 22:07:55 +0100

On Tue, Jul 23, 2019 at 07:56:46PM +0200, Oliver Hartkopp wrote:
> I just found an older log booting a Linux 4.9 where it was ok:
> 
> Jan  6 20:57:03 sam kernel: [    0.000000] Booting Linux on physical CPU 0x0
> Jan  6 20:57:03 sam kernel: [    0.000000] Linux version 4.9.0-4-marvell
> ([email-masked]) (gcc version 6.3.0 20170516 (Debian
> 6.3.0-18) ) #1 Debian 4.9.51-1 (2017-09-28)
> Jan  6 20:57:03 sam kernel: [    0.000000] CPU: Feroceon 88FR131 [56251311]
> revision 1 (ARMv5TE), cr=0005397f
> Jan  6 20:57:03 sam kernel: [    0.000000] CPU: VIVT data cache, VIVT
> instruction cache
> Jan  6 20:57:03 sam kernel: [    0.000000] OF: fdt:Machine model: QNAP TS219
> family
> 
> (..)
> 
> Jan  6 20:57:03 sam kernel: [    1.052175] mousedev: PS/2 mouse device
> common for all mice
> Jan  6 20:57:03 sam kernel: [    2.090654] rtc-mv f1010300.rtc: internal RTC
> not ticking
> Jan  6 20:57:03 sam kernel: [    2.096219] i2c /dev entries driver
> Jan  6 20:57:03 sam kernel: [    2.101859] rtc-s35390a 0-0030: rtc core:
> registered rtc-s35390a as rtc0
> Jan  6 20:57:03 sam kernel: [    2.109296] ledtrig-cpu: registered to
> indicate activity on CPUs
> Jan  6 20:57:03 sam kernel: [    2.115640] NET: Registered protocol family
> 17
> Jan  6 20:57:03 sam kernel: [    2.120536] registered taskstats version 1
> Jan  6 20:57:03 sam kernel: [    2.124695] zswap: loaded using pool lzo/zbud
> Jan  6 20:57:03 sam kernel: [    2.129852] random: fast init done
> Jan  6 20:57:03 sam kernel: [    2.133441] rtc-s35390a 0-0030: setting
> system clock to 2018-01-06 19:56:53 UTC (1515268613)
> Jan  6 20:57:03 sam kernel: [    2.143039] Freeing unused kernel memory:
> 296K
> 
> Just wondering whether this a kernel problem or a systemd thing.
> 
> At least the rtc-s35390a module is loaded before is is accessed.

This looks like it was built-in to this kernel.  The other kernel log
shows that it was loaded later.

> 
> Regards,
> Oliver
> 
> > Hi Andrew,
> > 
> > On 23.07.19 18:12, Andrew Lunn wrote:
> > > On Tue, Jul 23, 2019 at 05:30:48PM +0200, Oliver Hartkopp wrote:
> > 
> > > > I upgraded my TS-219 to Debian Buster with Kernel 4.19.0-5-marvell.
> > > 
> > > Hi Oliver
> > > 
> > > Did the same test work with older Debians?
> > > 
> > 
> > I'm not really sure when it happened, as I was using the 'testing'
> > release which now lead to Buster. I have no clear point where to look.
> > Just detected some boot delay and looked into the sysctl log wich moved
> > the clock forward based on fact, that the installed binaries where
> > younger than the system clock. %-(
> > 
> > > > I wonder whether the problem comes from a missing interrupt assignment
> > > > 
> > > > rtc: rtc@10300 {
> > > >               compatible = "marvell,kirkwood-rtc", "marvell,orion-rtc";
> > > >               reg = <0x10300 0x20>;
> > > >               interrupts = <53>;            <- HERE!?!
> > > >               clocks = <&gate_clk 7>;
> > > >                 };
> > > > 
> > > > ... I found in linux/arch/arm/boot/dts/kirkwood-6282.dtsi ?!?
> > > > 
> > > > In /proc/interrupts there's no rtc assigned to an interrupt 53.
> > > 
> > > There is code in the driver to request this interrupt. Do you see an
> > > error message like:
> > > 
> > > interrupt not available.
> > > 
> > 
> > No.
> > 
> > > > Accessing the rtc values (time/date) via /sys/class/rtc/rtc0
> > > > entries works
> > > > well and setting the date/time via "hwclock --systohc" does its
> > > > job too. So
> > > > I2C and the rtc_s35390a driver seem to work so far.
> > > 
> > > Now i'm confused. I don't see any mention of s35390a for any TS
> > > devices. Some kirkwood machines do make use of an external RTC, not
> > > the built in. But not this machine, as far as i know.
> > 
> > I snipped some dmesg log pointing to the machine & clock/rtc:
> > 
> > [    0.000000] Booting Linux on physical CPU 0x0
> > [    0.000000] Linux version 4.19.0-5-marvell
> > ([email-masked]) (gcc version 8.3.0 (Debian 8.3.0-7)) #1
> > Debian 4.19.37-5 (2019-06-19)
> > [    0.000000] CPU: Feroceon 88FR131 [56251311] revision 1 (ARMv5TE),
> > cr=0005397f
> > [    0.000000] CPU: VIVT data cache, VIVT instruction cache
> > [    0.000000] OF: fdt: Machine model: QNAP TS219 family
> > 
> > (..)
> > 
> > [    0.000000] clocksource: orion_clocksource: mask: 0xffffffff
> > max_cycles: 0xffffffff, max_idle_ns: 9556302233 ns
> > [    0.000006] sched_clock: 32 bits at 200MHz, resolution 5ns, wraps
> > every 10737418237ns
> > [    0.000030] Switching to timer-based delay loop, resolution 5ns
> > [    0.000099] Calibrating delay loop (skipped), value calculated using
> > timer frequency.. 400.00 BogoMIPS (lpj=800000)
> > [    0.000117] pid_max: default: 32768 minimum: 301
> > [    0.000329] Security Framework initialized
> > [    0.000344] Yama: disabled by default; enable with sysctl kernel.yama.*
> > [    0.000427] AppArmor: AppArmor initialized
> > [    0.000528] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
> > [    0.000544] Mountpoint-cache hash table entries: 1024 (order: 0, 4096
> > bytes)
> > [    0.001288] CPU: Testing write buffer coherency: ok
> > [    0.002027] Setting up static identity map for 0x8200 - 0x823c
> > [    0.002207] mvebu-soc-id: MVEBU SoC ID=0x6282, Rev=0x0
> > [    0.003536] devtmpfs: initialized
> > [    0.006261] VFP support v0.3: not present
> > [    0.006378] clocksource: jiffies: mask: 0xffffffff max_cycles:
> > 0xffffffff, max_idle_ns: 7645041785100000 ns
> > 
> > (..)
> > 
> > [    1.198026] hctosys: unable to open rtc device (rtc0)
> > [    1.205324] Freeing unused kernel memory: 312K
> > [    1.209804] This architecture does not have kernel memory protection.
> > [    1.216276] Run /init as init process
> > [    1.299536] random: fast init done
> > [    1.581741] rtc-s35390a 0-0030: rtc core: registered rtc-s35390a as rtc0
> > 
> > (..)
> > 
> > [   11.395565] rtc-mv f1010300.rtc: internal RTC not ticking
> > 
> > I got the information from Martin Michlmayr's Quap Debian pages:
> > http://www.cyrius.com/debian/kirkwood/qnap/ts-219/status/
> > http://www.cyrius.com/debian/kirkwood/qnap/ts-119/status/
> > 
> > RTC: Supported in the kernel by the rtc-s35390a module
> > 
> > Thanks for your help!
> > 
> > Best,
> > Oliver
> 
> _______________________________________________
> linux-arm-kernel mailing list
> [email-masked]
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up

_______________________________________________
linux-arm-kernel mailing list
[email-masked]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel