Other Parts Discussed in Thread: AM4372,
Tool/software: Linux
I'm trying to read the internal RTC on the AM4378 on a custom board running Linux, kernel version 4.1.18. I have set up the device tree using "/arch/arm/boot/dts/am437x-gp-evm.dts" as a guide. I do not have an external clock source. This includes "am4372.dtsi" by default, which includes this section, which configures the RTC.
rtc: rtc@44e3e000 {
compatible = "ti,am4372-rtc", "ti,am3352-rtc", "ti,da830-rtc";
reg = <0x44e3e000 0x1000>;
interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH
GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>;
ti,hwmods = "rtc";
system-power-controller;
status = "disabled";
};
In my own custom dts file based on "am437x-gp-evm.dts", I have the following lines.
&rtc {
status = "okay";
};
My understanding is that this should enable the internal RTC. During boot I observe the following:
[ 1.251581] omap_rtc 44e3e000.rtc: rtc core: registered 44e3e000.rtc as rtc0
...
[ 1.472652] omap_rtc 44e3e000.rtc: hctosys: unable to read the hardware clock
I believe this indicates that the "omap_rtc" driver is loading properly. The RTC appears in the device tree (as /dev/rtc0).
The problem is that I cannot seem to read from this device. I have reviewed the information regarding "hwclock", and the following shows the results of various commands.
# hwclock --help
BusyBox v1.23.2 (2017-08-09 12:21:48 EDT) multi-call binary.
Usage: hwclock [-r|--show] [-s|--hctosys] [-w|--systohc] [-t|--systz] [-l|--localtime] [-u|--utc] [-f|--rtc FILE]
Query and set hardware clock (RTC)
-r Show hardware clock time
-s Set system time from hardware clock
-w Set hardware clock from system time
-t Set in-kernel timezone, correct system time
if hardware clock is in local time
-u Assume hardware clock is kept in UTC
-l Assume hardware clock is kept in local time
-f FILE Use specified device (e.g. /dev/rtc2)
# hwclock -r -f /dev/rtc0
hwclock: RTC_RD_TIME: Invalid argument
This seems to indicate a problem with the ioctl function call within the "omap_rtc" driver.
# hwclock -w -f /dev/rtc0
<no output>
It is unclear from this function call whether or not the write (setting the HW clock) was successful.