RTC m41t81s



  • We try to add RTC m41t81s
    First of all we ensure that RTC is worked fine

    i2cset  -y  0  0x68  12 1 b
    i2cget -y 0 0x68 3 0x7f
    

    and all is good time is go
    We run

    make kernel_menuconfig
    

    so we select

    CONFIG_RTC_DRV_M41T80=y
    CONFIG_RTC_DRV_M41T80_WDT=y
    CONFIG_I2C_RALINK=y
    

    and i try add to DTS this section

    &i2c0 {
            status = "okay";
    
            rtc@68 {
                    compatible = "st,m41t80";
                    reg = <0x68>;
                    interrupt-parent = <&UIC0>;
                    interrupts = <0x9 0x8>;
            };
    };
    

    Then we try add driver as selected in RTC support of our chip m41t81s and watchdog and try build as module.
    successfully Make FW without errors.
    after install on omega 2s+ we can't find /dev/rtc0 and /dev/watchdog0 in both case.

    I don't have another idea what we need to do...

    We need help!
    May be we can order service request ore something else fore fastest response? it wery important as for us and for you, a large order may depend on it.


  • administrators

    @Moonshiner I'm guessing it's not working because of the DTS change.
    Looks like it should be &i2c, not &i2c0. See the Omega2 base DTS file for reference: https://github.com/OnionIoT/source/blob/openwrt-18.06/target/linux/ramips/dts/OMEGA2.dtsi#L142

    When the firmware is running on the device, you can use lsmod to see if the rtc kernel module is actually loaded into the kernel.



  • @Lazar-Demin Hi! Thanks for you answer!
    I made changes on dts
    and now have freeze system boot, log is

    Starting kernel ...
    
    [    0.000000] Linux version 4.14.81 (vagner@dev18) (gcc version 7.3.0 (OpenWrt GCC 7.3.0 r7480-77cc5cfc8f)) #0 Wed Nov 18 21:25:20 2020
    [    0.000000] Board has DDR2
    [    0.000000] Analog PMU set to hw control
    [    0.000000] Digital PMU set to hw control
    [    0.000000] SoC Type: MediaTek MT7688 ver:1 eco:2
    [    0.000000] bootconsole [early0] enabled
    [    0.000000] CPU0 revision is: 00019655 (MIPS 24KEc)
    [    0.000000] MIPS: machine is Onion Omega2+
    [    0.000000] Determined physical RAM map:
    [    0.000000]  memory: 08000000 @ 00000000 (usable)
    [    0.000000] Initrd not found or empty - disabling initrd
    [    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
    [    0.000000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
    [    0.000000] Zone ranges:
    [    0.000000]   Normal   [mem 0x0000000000000000-0x0000000007ffffff]
    [    0.000000] Movable zone start for each node
    [    0.000000] Early memory node ranges
    [    0.000000]   node   0: [mem 0x0000000000000000-0x0000000007ffffff]
    [    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000007ffffff]
    [    0.000000] random: get_random_bytes called from start_kernel+0x8c/0x474 with crng_init=0
    [    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 32512
    [    0.000000] Kernel command line: console=ttyS0,115200 rootfstype=squashfs,jffs2
    [    0.000000] PID hash table entries: 512 (order: -1, 2048 bytes)
    [    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
    [    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
    [    0.000000] Writing ErrCtl register=000709be
    [    0.000000] Readback ErrCtl register=000709be
    [    0.000000] Memory: 124580K/131072K available (3733K kernel code, 214K rwdata, 932K rodata, 168K init, 205K bss, 6492K reserved, 0K cma-reserved)
    [    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
    [    0.000000] NR_IRQS: 256
    [    0.000000] intc: using register map from devicetree
    [    0.000000] CPU Clock: 580MHz
    [    0.000000] timer_probe: no matching timers found
    [    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 6590553264 ns
    [    0.000012] sched_clock: 32 bits at 290MHz, resolution 3ns, wraps every 7405115902ns
    [    0.007670] Console: colour dummy device 80x25
    [    0.011928] Calibrating delay loop... 385.84 BogoMIPS (lpj=1929216)
    [    0.073503] pid_max: default: 32768 minimum: 301
    [    0.078190] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
    [    0.084534] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
    [    0.098583] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
    [    0.108082] futex hash table entries: 256 (order: -1, 3072 bytes)
    [    0.114025] pinctrl core: initialized pinctrl subsystem
    [    0.119598] NET: Registered protocol family 16
    [    0.156724] mt7621_gpio 10000600.gpio: registering 32 gpios
    [    0.162382] mt7621_gpio 10000600.gpio: registering 32 gpios
    [    0.167901] mt7621_gpio 10000600.gpio: registering 32 gpios
    [    0.174633] i2c-mt7621 10000900.i2c: clock 100 kHz
    [    0.184591] clocksource: Switched to clocksource MIPS
    [    0.196320] NET: Registered protocol family 2
    [    0.201440] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
    [    0.208193] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
    [    0.214288] TCP: Hash tables configured (established 1024 bind 1024)
    [    0.220568] UDP hash table entries: 256 (order: 0, 4096 bytes)
    [    0.226213] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
    [    0.232494] NET: Registered protocol family 1
    [    0.251478] Crashlog allocated RAM at address 0x3f00000
    [    0.258138] workingset: timestamp_bits=30 max_order=15 bucket_order=0
    [    0.270374] squashfs: version 4.0 (2009/01/31) Phillip Lougher
    [    0.275995] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
    [    0.295960] io scheduler noop registered
    [    0.299694] io scheduler deadline registered (default)
    [    0.305763] gpio-mockup: probe of gpio-mockup failed with error -22
    [    0.311961] Serial: 8250/16550 driver, 3 ports, IRQ sharing disabled
    [    0.319340] console [ttyS0] disabled
    [    0.322777] 10000c00.uartlite: ttyS0 at MMIO 0x10000c00 (irq = 28, base_baud = 2500000) is a 16550A
    [    0.331550] console [ttyS0] enabled
    [    0.331550] console [ttyS0] enabled
    [    0.338542] bootconsole [early0] disabled
    [    0.338542] bootconsole [early0] disabled
    [    0.347335] 10000d00.uart1: ttyS1 at MMIO 0x10000d00 (irq = 29, base_baud = 2500000) is a 16550A
    [    0.356961] 10000e00.uart2: ttyS2 at MMIO 0x10000e00 (irq = 30, base_baud = 2500000) is a 16550A
    [    0.366490] cacheinfo: Failed to find cpu0 device node
    [    0.371701] cacheinfo: Unable to detect cache hierarchy for CPU 0
    [    0.378688] spi-mt7621 10000b00.spi: sys_freq: 193333333
    [    0.399077] m25p80 spi0.0: w25q256 (32768 Kbytes)
    [    0.403908] 5 fixed-partitions partitions found on MTD device spi0.0
    [    0.410368] Creating 5 MTD partitions on "spi0.0":
    [    0.415244] 0x000000000000-0x000000030000 : "u-boot"
    [    0.421243] 0x000000030000-0x000000040000 : "u-boot-env"
    [    0.427546] 0x000000040000-0x000000050000 : "factory"
    [    0.433479] 0x000000050000-0x000001f80000 : "firmware"
    [    0.528733] 2 uimage-fw partitions found on MTD device firmware
    [    0.534782] 0x000000050000-0x0000001dde4a : "kernel"
    [    0.540743] 0x0000001dde4a-0x000001f80000 : "rootfs"
    [    0.546636] mtd: device 5 (rootfs) set to be root filesystem
    [    0.553885] 1 squashfs-split partitions found on MTD device rootfs
    [    0.560235] 0x000000b30000-0x000001f80000 : "rootfs_data"
    [    0.566668] 0x000001f80000-0x000002000000 : "user"
    [    0.573324] libphy: Fixed MDIO Bus: probed
    [    0.589194] rt3050-esw 10110000.esw: link changed 0x00
    [    0.596107] mtk_soc_eth 10100000.ethernet eth0: mediatek frame engine at 0xb0100000, irq 5
    [    0.606025] rtc-m41t80 0-0068: Oscillator failure, data is invalid.
    [    0.612387] rtc-m41t80 0-0068: HT bit was set!
    [    0.616947] rtc-m41t80 0-0068: Power Down at -2142107796-01--2142540296 -2016674272:-2129641812:-2016279616
    [    0.628663] rtc-m41t80 0-0068: Oscillator failure, data is invalid.
    [    0.635217] rtc-m41t80 0-0068: registered as rtc0
    [    0.640162] i2c /dev entries driver
    [    0.643995] watchdog: Mediatek Watchdog: cannot register miscdev on minor=130 (err=-16).
    [    0.652255] watchdog: Mediatek Watchdog: a legacy watchdog module is probably present.
    [    0.660676] ledtrig-cpu: registered to indicate activity on CPUs
    [    0.667978] NET: Registered protocol family 10
    [    0.678098] Segment Routing with IPv6
    [    0.681943] NET: Registered protocol family 17
    [    0.686568] 8021q: 802.1Q VLAN Support v1.8
    [    0.692695] rtc-m41t80 0-0068: Oscillator failure, data is invalid.
    [    0.699136] rtc-m41t80 0-0068: hctosys: unable to read the hardware clock
    [    0.710706] VFS: Mounted root (squashfs filesystem) readonly on device 31:5.
    [    0.718838] Freeing unused kernel memory: 168K
    [    0.723345] This architecture does not have kernel memory protection.
    [    1.518907] init: Console is alive
    [    1.522587] init: - watchdog -
    

    I have check chipset of RTC its correct and i write it on dts as

                compatible = "st,m41t81s";
    

    How we can resolve this mistake?


  • administrators

    @Moonshiner you previously had it set to compatible = "st,m41t80";. Why the change?

    The compatible string binds a device with a driver. If there's no driver with a matching compatible string, then the module won't be able to load. I suspect that's what's happening here.

    You'll have to check the RTC kernel driver to see what compatible strings it supports.



  • @Lazar-Demin, i have see the error when "m41t80"

    [    0.654513] rtc-m41t80 0-0068: Oscillator failure, data is invalid.
    [    0.660957] rtc-m41t80 0-0068: hctosys: unable to read the hardware clock
    

    and think that may be not correct becouse mistake in driver

    Looked at chip and driver
    and changed to "m41t81s"
    After that sistem have freeze



  • seem i found a problem - it's abattery
    If we don't se on chip model and return from m41t81s to m41t80 in dts all worked fine RTC and watchdog(but watchodg has only on 81s)



Looks like your connection to Community was lost, please wait while we try to reconnect.