How to enable internal RTC for iMX7D

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to enable internal RTC for iMX7D

3,687 Views
isaacnickaein
Contributor III

What settings (if any) should be added to device tree to enable the internal RTC for i.MX7D 1GB module? 

I have already enabled the drivers in kernel config, but I am not sure what should be added in DTS.

The kernel I am using is 4.9.67.

Here is the relevant RTC kernel configs. I think I have enabled the required drivers:

CONFIG_RTC_LIB=y
CONFIG_RTC_CLASS=y
CONFIG_RTC_HCTOSYS=y
CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
CONFIG_RTC_SYSTOHC=y
CONFIG_RTC_SYSTOHC_DEVICE="rtc0"


CONFIG_RTC_INTF_SYSFS=y
CONFIG_RTC_INTF_PROC=y
CONFIG_RTC_INTF_DEV=y
CONFIG_RTC_DRV_DS1307=y
CONFIG_RTC_DRV_DS1307_HWMON=y

CONFIG_RTC_I2C_AND_SPI=y

CONFIG_RTC_DRV_SNVS=y

But no messages related to RTC is shown up in the dmesg, except an error indicating rtc0 device is not present.

Here is full dmesg log:

[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 4.9.67-00001-gda84bd4-dirty (samim@ubuntu) (gcc version 7.2.0 (GCC) ) #1 SMP Mon Jan 22 13:53:29 IRST 2018
[ 0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c5387d
[ 0.000000] CPU: div instructions available: patching division code
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[ 0.000000] OF: fdt:Machine model: Toradex Colibri iMX7D 1GB on Colibri Evaluation Board V3
[ 0.000000] Reserved memory: created CMA memory pool at 0xac000000, size 320 MiB
[ 0.000000] OF: reserved mem: initialized node linux,cma, compatible id shared-dma-pool
[ 0.000000] Memory policy: Data cache writealloc
[ 0.000000] On node 0 totalpages: 262144
[ 0.000000] free_area_init_node: node 0, pgdat 80c480c0, node_mem_map ab75a000
[ 0.000000] Normal zone: 2048 pages used for memmap
[ 0.000000] Normal zone: 0 pages reserved
[ 0.000000] Normal zone: 262144 pages, LIFO batch:31
[ 0.000000] percpu: Embedded 14 pages/cpu @ab71f000 s25804 r8192 d23348 u57344
[ 0.000000] pcpu-alloc: s25804 r8192 d23348 u57344 alloc=14*4096
[ 0.000000] pcpu-alloc: [0] 0 [0] 1
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 260096
[ 0.000000] Kernel command line: ip=off root=/dev/mmcblk0p2 ro rootfstype=ext4 rootwait console=tty1 console=ttymxc0,115200n8 consoleblank=0 video=mxsfb:640x480M-16@60
[ 0.000000] PID hash table entries: 4096 (order: 2, 16384 bytes)
[ 0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
[ 0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
[ 0.000000] Memory: 698996K/1048576K available (7168K kernel code, 291K rwdata, 2068K rodata, 1024K init, 409K bss, 21900K reserved, 327680K cma-reserved)
[ 0.000000] Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xffc00000 - 0xfff00000 (3072 kB)
vmalloc : 0xc0800000 - 0xff800000 (1008 MB)
lowmem : 0x80000000 - 0xc0000000 (1024 MB)
modules : 0x7f000000 - 0x80000000 ( 16 MB)
.text : 0x80008000 - 0x80800000 (8160 kB)
.init : 0x80b00000 - 0x80c00000 (1024 kB)
.data : 0x80c00000 - 0x80c48c60 ( 292 kB)
.bss : 0x80c4a000 - 0x80cb0780 ( 410 kB)
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
[ 0.000000] Hierarchical RCU implementation.
[ 0.000000] Build-time adjustment of leaf fanout to 32.
[ 0.000000] RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2.
[ 0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=32, nr_cpu_ids=2
[ 0.000000] NR_IRQS:16 nr_irqs:16 16
[ 0.000000] arm_arch_timer: Architected cp15 timer(s) running at 8.00MHz (phys).
[ 0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x1d854df40, max_idle_ns: 440795202120 ns
[ 0.000007] sched_clock: 56 bits at 8MHz, resolution 125ns, wraps every 2199023255500ns
[ 0.000019] Switching to timer-based delay loop, resolution 125ns
[ 0.000337] Ignoring duplicate/late registration of read_current_timer delay
[ 0.000354] clocksource: mxc_timer1: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 637086815595 ns
[ 0.001876] Console: colour dummy device 80x30
[ 0.002560] console [tty1] enabled
[ 0.002593] Calibrating delay loop (skipped), value calculated using timer frequency.. 16.00 BogoMIPS (lpj=80000)
[ 0.002643] pid_max: default: 32768 minimum: 301
[ 0.002750] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.002782] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.003494] CPU: Testing write buffer coherency: ok
[ 0.003809] Setting up static identity map for 0x80100000 - 0x80100058
[ 0.005770] Brought up 2 CPUs
[ 0.005808] SMP: Total of 2 processors activated (32.00 BogoMIPS).
[ 0.005834] CPU: All CPU(s) started in SVC mode.
[ 0.006536] devtmpfs: initialized
[ 0.019148] VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 5
[ 0.019512] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.019572] futex hash table entries: 512 (order: 3, 32768 bytes)
[ 0.030846] pinctrl core: initialized pinctrl subsystem
[ 0.032020] NET: Registered protocol family 16
[ 0.037501] DMA: preallocated 256 KiB pool for atomic coherent allocations
[ 0.059958] cpuidle: using governor menu
[ 0.070749] DDR type is DDR3!
[ 0.079086] imx7d_enet_clk_sel: failed to get enet_out clock, assuming ext. clock source
[ 0.079165] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers.
[ 0.079207] hw-breakpoint: maximum watchpoint size is 8 bytes.
[ 0.079539] imx7d-pinctrl 302c0000.iomuxc-lpsr: initialized IMX pinctrl driver
[ 0.080927] imx7d-pinctrl 30330000.iomuxc: initialized IMX pinctrl driver
[ 0.081858] imx-gpcv2 30000000.aips-bus:pgc: mipi regulator not ready.
[ 0.082454] MU is ready for cross core communication!
[ 0.105416] mxs-dma 33000000.dma-apbh: initialized
[ 0.106896] VCC_USB[1-4]: supplied by 5V
[ 0.107524] SCSI subsystem initialized
[ 0.107832] usbcore: registered new interface driver usbfs
[ 0.107925] usbcore: registered new interface driver hub
[ 0.108061] usbcore: registered new device driver usb
[ 0.108282] 30800000.aips-bus:usbphynop1 supply vcc not found, using dummy regulator
[ 0.108552] 30800000.aips-bus:usbphynop2 supply vcc not found, using dummy regulator
[ 0.109636] i2c i2c-0: IMX I2C adapter registered
[ 0.109674] i2c i2c-0: can't use DMA, using PIO instead.
[ 0.110329] i2c i2c-3: IMX I2C adapter registered
[ 0.110367] i2c i2c-3: can't use DMA, using PIO instead.
[ 0.110571] pps_core: LinuxPPS API ver. 1 registered
[ 0.110600] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[ 0.110665] PTP clock support registered
[ 0.111140] imx rpmsg driver is registered.
[ 0.112433] clocksource: Switched to clocksource arch_sys_counter
[ 0.112571] VFS: Disk quotas dquot_6.6.0
[ 0.112648] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[ 0.123357] NET: Registered protocol family 2
[ 0.123978] TCP established hash table entries: 8192 (order: 3, 32768 bytes)
[ 0.124101] TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
[ 0.124264] TCP: Hash tables configured (established 8192 bind 8192)
[ 0.124346] UDP hash table entries: 512 (order: 2, 16384 bytes)
[ 0.124417] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
[ 0.124619] NET: Registered protocol family 1
[ 0.125040] RPC: Registered named UNIX socket transport module.
[ 0.125073] RPC: Registered udp transport module.
[ 0.125098] RPC: Registered tcp transport module.
[ 0.125121] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 0.126880] Bus freq driver module loaded
[ 0.128347] workingset: timestamp_bits=30 max_order=18 bucket_order=0
[ 0.136670] NFS: Registering the id_resolver key type
[ 0.136725] Key type id_resolver registered
[ 0.136749] Key type id_legacy registered
[ 0.136782] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[ 0.137382] ntfs: driver 2.1.32 [Flags: R/W].
[ 0.137744] fuse init (API version 7.26)
[ 0.143248] io scheduler noop registered
[ 0.143284] io scheduler deadline registered
[ 0.143486] io scheduler cfq registered (default)
[ 0.145831] 30730000.lcdif supply lcd not found, using dummy regulator
[ 0.210774] mxsfb 30730000.lcdif: failed to find mxc display driver
[ 0.219803] Console: switching to colour frame buffer device 80x30
[ 0.238217] mxsfb 30730000.lcdif: initialized
[ 0.241728] imx-sdma 30bd0000.sdma: no iram assigned, using external mem
[ 0.245014] imx-sdma 30bd0000.sdma: loaded firmware 4.2
[ 0.251887] 30860000.serial: ttymxc0 at MMIO 0x30860000 (irq = 53, base_baud = 1500000) is a IMX
[ 0.944075] console [ttymxc0] enabled
[ 0.950570] 30890000.serial: ttymxc1 at MMIO 0x30890000 (irq = 54, base_baud = 1500000) is a IMX
[ 0.964235] 30880000.serial: ttymxc2 at MMIO 0x30880000 (irq = 55, base_baud = 500000) is a IMX
[ 0.984674] loop: module loaded
[ 0.995289] vdd1p0d: supplied by DCDC3
[ 1.012208] spi_imx 30840000.ecspi: dma setup error -19, use pio
[ 1.020889] spi_imx 30840000.ecspi: probed
[ 1.027757] libphy: Fixed MDIO Bus: probed
[ 1.034528] CAN device driver interface
[ 1.040887] 30a00000.can supply xceiver not found, using dummy regulator
[ 1.050670] flexcan 30a00000.can: device registered (reg_base=f5a00000, irq=58)
[ 1.062514] 30a10000.can supply xceiver not found, using dummy regulator
[ 1.072301] flexcan 30a10000.can: device registered (reg_base=f5a10000, irq=59)
[ 1.087533] pps pps0: new PPS source ptp0
[ 1.099209] libphy: fec_enet_mii_bus: probed
[ 1.106776] fec 30be0000.ethernet eth0: registered PHC device 0
[ 1.115325] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 1.124309] ehci-mxc: Freescale On-Chip EHCI Host driver
[ 1.132237] usbcore: registered new interface driver usb-storage
[ 1.140789] usbcore: registered new interface driver usbserial
[ 1.149031] usbcore: registered new interface driver usbserial_generic
[ 1.157926] usbserial: USB Serial support registered for generic
[ 1.166280] usbcore: registered new interface driver ftdi_sio
[ 1.174382] usbserial: USB Serial support registered for FTDI USB Serial Device
[ 1.186252] usbcore: registered new interface driver pl2303
[ 1.194202] usbserial: USB Serial support registered for pl2303
[ 1.203567] 30b10200.usbmisc supply vbus-wakeup not found, using dummy regulator
[ 1.215648] 30b30200.usbmisc supply vbus-wakeup not found, using dummy regulator
[ 1.227845] 30b20200.usbmisc supply vbus-wakeup not found, using dummy regulator
[ 1.243955] ci_hdrc ci_hdrc.0: EHCI Host Controller
[ 1.251321] ci_hdrc ci_hdrc.0: new USB bus registered, assigned bus number 1
[ 1.282469] ci_hdrc ci_hdrc.0: USB 2.0 started, EHCI 1.00
[ 1.291389] hub 1-0:1.0: USB hub found
[ 1.297670] hub 1-0:1.0: 1 port detected
[ 1.304999] mousedev: PS/2 mouse device common for all mice
[ 1.316012] input: AD7879 Touchscreen as /devices/soc0/soc/30800000.aips-bus/30a20000.i2c/i2c-0/0-002c/input/input0
[ 1.331974] i2c /dev entries driver
[ 1.339895] imx2-wdt 30280000.wdog: timeout 60 sec (nowayout=0)
[ 1.349628] sdhci: Secure Digital Host Controller Interface driver
[ 1.358258] sdhci: Copyright(c) Pierre Ossman
[ 1.365004] sdhci-pltfm: SDHCI platform and OF driver helper
[ 1.373942] sdhci-esdhc-imx 30b40000.usdhc: Got CD GPIO
[ 1.442578] mmc1: SDHCI controller on 30b40000.usdhc [30b40000.usdhc] using ADMA
[ 1.516688] mmc1: new high speed SD card at address 0001
[ 1.524589] mmc0: SDHCI controller on 30b60000.usdhc [30b60000.usdhc] using ADMA
[ 1.537710] mmcblk1: mmc1:0001 SD 1.85 GiB
[ 1.545282] caam 30900000.caam: ERA source: CCBVID.
[ 1.559582] caam 30900000.caam: Entropy delay = 3200
[ 1.566590] mmcblk1: p1
[ 1.571635] caam 30900000.caam: Instantiated RNG4 SH0
[ 1.631047] caam 30900000.caam: Instantiated RNG4 SH1
[ 1.637947] caam 30900000.caam: device ID = 0x0a16030000000000 (Era 8)
[ 1.646294] caam 30900000.caam: job rings = 3, qi = 0
[ 1.678239] caam algorithms registered in /proc/crypto
[ 1.688222] caam_jr 30901000.jr0: registering rng-caam
[ 1.695307] caam 30900000.caam: caam pkc algorithms registered in /proc/crypto
[ 1.706497] hidraw: raw HID events driver (C) Jiri Kosina
[ 1.713950] usbcore: registered new interface driver usbhid
[ 1.721272] usbhid: USB HID core driver
[ 1.731504] coresight-etm3x 3007c000.etm: ETM 3.5 initialized
[ 1.739548] coresight-etm3x 3007d000.etm: ETM 3.5 initialized
[ 1.747199] Netfilter messages via NETLINK v0.30.
[ 1.753607] nfnl_acct: registering with nfnetlink.
[ 1.760293] nf_conntrack version 0.5.0 (16384 buckets, 65536 max)
[ 1.768381] nf_tables: (c) 2007-2009 Patrick McHardy <kaber@trash.net>
[ 1.776858] ip_tables: (C) 2000-2006 Netfilter Core Team
[ 1.784412] NET: Registered protocol family 10
[ 1.793140] ip6_tables: (C) 2000-2006 Netfilter Core Team
[ 1.800245] NET: Registered protocol family 17
[ 1.806412] Bridge firewalling registered
[ 1.812029] can: controller area network core (rev 20120528 abi 9)
[ 1.820023] NET: Registered protocol family 29
[ 1.826105] can: raw protocol (rev 20120528)
[ 1.831933] can: broadcast manager protocol (rev 20161123 t)
[ 1.839189] can: netlink gateway (rev 20130117) max_hops=1
[ 1.846459] 8021q: 802.1Q VLAN Support v1.8
[ 1.852280] Key type dns_resolver registered
[ 1.864605] Registering SWP/SWPB emulation handler
[ 1.875255] registered taskstats version 1
[ 1.890419] mmc0: new HS400 MMC card at address 0001
[ 1.902532] mmcblk0: mmc0:0001 Q2J54A 3.64 GiB
[ 1.909218] mmcblk0boot0: mmc0:0001 Q2J54A partition 1 2.00 MiB
[ 1.917058] mmcblk0boot1: mmc0:0001 Q2J54A partition 2 2.00 MiB
[ 1.925835] mmcblk0: p1 p2
[ 1.942482] random: fast init done
[ 2.503839] imx_thermal 30000000.aips-bus:tempmon: Extended Commercial CPU temperature grade - max:105C critical:100C passive:95C
[ 2.520666] input: gpio-keys as /devices/soc0/gpio-keys/input/input1
[ 2.529532] hctosys: unable to open rtc device (rtc0)
[ 2.557876] +V3.3: disabling
[ 2.562403] +V3.3_AVDD_AUDIO: disabling
[ 2.576783] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[ 2.588275] VFS: Mounted root (ext4 filesystem) readonly on device 179:2.
[ 2.598899] devtmpfs: mounted
[ 2.604668] Freeing unused kernel memory: 1024K
[ 2.693178] systemd[1]: System time before build time, advancing clock.
[ 2.716163] systemd[1]: systemd 234 running in system mode. (+PAM -AUDIT -SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP -LIBCRYPTSETUP -GCRYPT -GNUTLS -ACL -XZ +LZ4 -SECCOMP +BLKID -ELFUTILS +KMOD -IDN2 +IDN default-hierarchy=hybrid)
[ 2.744289] systemd[1]: Detected architecture arm.
[ 2.783023] systemd[1]: Set hostname to <colibri-imx7-emmc>.
[ 3.000506] systemd[1]: Listening on /dev/initctl Compatibility Named Pipe.
[ 3.042893] systemd[1]: Listening on Journal Socket.
[ 3.082826] systemd[1]: Started Forward Password Requests to Wall Directory Watch.
[ 3.122702] systemd[1]: Reached target Remote File Systems.
[ 3.162871] systemd[1]: Started Dispatch Password Requests to Console Directory Watch.
[ 3.202648] systemd[1]: Reached target Paths.
[ 3.243230] systemd[1]: Created slice User and Session Slice.
[ 3.798279] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[ 4.118582] systemd-journald[193]: Received request to flush runtime journal from PID 1
[ 4.138703] systemd-journald[193]: File /var/log/journal/8207b698f4924866ae8061b92bb22c0a/system.journal corrupted or uncleanly shut down, renaming and replacing.
[ 5.352933] using random self ethernet address
[ 5.359745] using random host ethernet address
[ 5.606341] FAT-fs (mmcblk1p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
[ 5.872646] Micrel KSZ8041 30be0000.ethernet-1:00: attached PHY driver [Micrel KSZ8041] (mii_bus:phy_addr=30be0000.ethernet-1:00, irq=-1)
[ 5.889535] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[ 7.993096] fec 30be0000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx
[ 8.001194] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[ 206.752537] random: crng init done

Labels (2)
3 Replies

2,302 Views
CarlosCasillas
NXP Employee
NXP Employee

toradex do you have any comment regarding this?

2,302 Views
isaacnickaein
Contributor III

Hi Carlos,

I've also asked this question on Toradex's forum here:

How to enable internal RTC on Colibri iMX7 1GB - Toradex Community 

Apparently, the internal RTC can be enabled by adding a snvs node to the device tree as follows. More info can be found on the post for anyone having the similar issue.

Cheers,

--- a/arch/arm/boot/dts/imx7s.dtsi
+++ b/arch/arm/boot/dts/imx7s.dtsi
@@ -643,6 +643,34 @@
reg = <0x30370000 0x10000>;
};

+ snvs: snvs@30370000 {
+ compatible = "fsl,sec-v4.0-mon", "syscon", "simple-mfd";
+ reg = <0x30370000 0x10000>;
+
+ snvs_rtc: snvs-rtc-lp {
+ compatible = "fsl,sec-v4.0-mon-rtc-lp";
+ regmap = <&snvs>;
+ offset = <0x34>;
+ interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>;
+ };
+
+ snvs_poweroff: snvs-poweroff {
+ compatible = "syscon-poweroff";
+ regmap = <&snvs>;
+ offset = <0x38>;
+ mask = <0x60>;
+ };
+
+ snvs_pwrkey: snvs-powerkey {
+ compatible = "fsl,sec-v4.0-pwrkey";
+ regmap = <&snvs>;
+ interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>;
+ linux,keycode = <KEY_POWER>;
+ wakeup-source;
+ };
+ };

2,302 Views
falstaff
Senior Contributor I

Yes this is an issue in our current 2.8b1 release (using NXP L4.9.11 release). There is a fix available on our -next branch:

linux-toradex.git - Linux kernel for Apalis and Colibri modules 

0 Kudos