This is a cache of https://discuss.96boards.org/t/how-to-enable-rtc-on-dragonboard-410c-with-linaro-15-07/188. It is a snapshot of the page at 2024-11-01T05:16:32.298+0000.
How to enable RTC on Dragonboard 410c With Linaro 15.07? - DragonBoard410c - 96Boards Forum

How to enable RTC on Dragonboard 410c With Linaro 15.07?

Is there anyway to enable RTC on Dragonboard 410c flashed with Linaro 15.07 release ?

Are you seeing this message on the kernel log?

[ 3.092406] …/drivers/rtc/hctosys.c: unable to open rtc device (rtc0)

Yes. Same kernel log. Do we have a work around for this ?

I didn’t find the compatible string in the device tree or interrupts registered to the real time clock. let me come back to you on this.

The RTC is in the PMIC.

Please enable CONFIG_RTC_DRV_PM8XXX in the config

And apply the following patch to the device tree:

[jramirez@calypso linux.git (ubuntu-qcom-dragonboard410c-15.07 *$%)]$ git diff arch/arm64/boot/dts/qcom/pm8916.dtsi
diff --git a/arch/arm64/boot/dts/qcom/pm8916.dtsi b/arch/arm64/boot/dts/qcom/pm8916.dtsi
index 7c85949…faabdb7 100644
— a/arch/arm64/boot/dts/qcom/pm8916.dtsi
+++ b/arch/arm64/boot/dts/qcom/pm8916.dtsi
@@ -9,6 +9,14 @@
#address-cells = <1>;
#size-cells = <0>;

  •          rtc@6000 {
    
  •                     compatible = "qcom,pm8941-rtc";
    
  •                     reg = <0x6000 0x6100>;
    
  •                     reg-names = "rtc", "alarm";
    
  •                     interrupts = <0x0 0x61 0x1 IRQ_TYPE_EDGE_RISING>;
    
  •           };
    
  •           pm8916_gpios: gpios@c000 {
                      compatible = "qcom,pm8916-gpio";
                      reg = <0xc000 0x400>;
    

During boot you should see something like this:

[ 2.091908] rtc-pm8xxx 200f000.spmi:pm8916@0:rtc@6000: rtc core: registered pm8xxx_rtc as rtc0
[ 3.118293] rtc-pm8xxx 200f000.spmi:pm8916@0:rtc@6000: setting system clock to 1970-01-01 00:02:01 UTC (121)

root@linaro-alip:~# hwclock
Thu 01 Jan 1970 12:06:33 AM UTC -1.321749 seconds

I still can see some issues though.

root@linaro-alip:~# hwclock --set --date 09/04/2015
hwclock: ioctl(RTC_SET_TIME) to /dev/rtc to set the time failed.: Permission denied

Please checkout these changes (will probably need merging)

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/drivers/rtc/rtc-pm8xxx.c?id=c8d523a4b053d1678adb92976b5ef84d9bc481e8

Thanks , i got the rtc0 node under /dev/. My kernel source already have all changes you suggested in your last post.

Still on executing date -s “2015-09-09 11:40:00” and on executing “hwclock -w” its still gives error as shown below.

root@linaro-alip:~# date -s “2015-09-09 11:40:00”
Wed Sep 9 11:40:00 UTC 2015
root@linaro-alip:~# hwclock -w
hwclock: ioctl(RTC_SET_TIME) to /dev/rtc to set the time failed.: Permission denied

Any workaround available ?

Hi anyone can suggest a workaround ?

I have done following changes

diff --git a/arch/arm64/boot/dts/qcom/pm8916.dtsi b/arch/arm64/boot/dts/qcom/pm8916.dtsi
index 008e856…985d162 100644
— a/arch/arm64/boot/dts/qcom/pm8916.dtsi
+++ b/arch/arm64/boot/dts/qcom/pm8916.dtsi
@@ -15,6 +15,7 @@
reg = <0x6000 0x6100>;
reg-names = “rtc”, “alarm”;
interrupts = <0x0 0x61 0x1 IRQ_TYPE_EDGE_RISING>;

  •                   <strong>allow-set-time;</strong>
              };
    

and on doing “hwclock -w” am not getting “hwclock: ioctl(RTC_SET_TIME) to /dev/rtc to set the time failed.: Permission denied” instead it is rebooting while disabling the alarm. Any workaround available ?

It seems to me that its rebooting on calling regmap_write function. Cause i comment the “disabling of alarm” code and checked. It fails on next regmap_write call. Is there any workaround ?

I also tried this patch https://patches.linaro.org/46624/. But its rebooting on “hwclock -w” command.

Can anyone help me to solve this ?

If you look at the driver code, once you enable (properly) allow-set-time to a valid boolean, you should be getting write access to the device.

After doing that I am also seeing the reboots you mention so I suppose the register mapping is somehow different to what we are asking for (the device tree asks for pm8941_regs which might not be the right choice for this device).

Let us look into this.

Unfortunately, the aarch64 cores can NOT change the RTC time (only consume it)

As a matter of fact, the write registers are not defined in the PM8916 register map.

Changing the RTC could be done from the GPS/DSP hosts.

I’ll try to get that information if it still of interest.

Can we define write register map for PM8916 ? If not, Can you please provide us the steps to change RTC using DSP host ?

Hi ldts,

Can you please provide update on this?

sorry it is not good news: I haven’t been able to find out how to do this.

there are two somewhat floating downstream patches that simulate RTC write via offset usage:

  1. imm/kernel - Unnamed repository

  2. imm/kernel - Unnamed repository

Hi ce1,

Thanks for the reply.
This is useful for the cases in which RTC write is not possible.

1 Like