External RTC Wake Up Problem

Colibri IMX6ULL
TDX Wayland with XWayland Upstream 6.3.0-devel-20230710131815+build.0 (kirkstone) colibri-imx6ull-07316921 ttymxc0
Colibri-iMX6ULL_Reference-Multimedia-Image-upstream

Hi,

I’m working on a patch for my custom board project. I’m using a pcf85063 as external RTC and everything is working fine except the wake up alarm. I want to use SODIMM 106 as interrupt pin and I’ve already disabled it as touchscreen interrupt pin.

The modifications I did at imx6ull-colibri-wifi-eval-v3.dtb were:

&i2c1 {
status = “okay”;

pcf85063: rtc@51 {
	compatible = "nxp,pcf85063a";
	reg = <0x51>;
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_rtc_int>;
	interrupt-names = "irq";
	interrupt-parent = <&gpio1>;
	interrupts = <10 IRQ_TYPE_EDGE_FALLING>;
	quartz-load-femtofarads = <7000>;
	clock {
		compatible = "fixed-clock";
		#clock-cells = <0>;
		clock-frequency = <32768>;
	};
};

};

&snvs_rtc {
status = “disabled”;
};

After boot I get:

[ 87.414772] irq 38: nobody cared (try booting with the “irqpoll” option)
[ 87.421558] CPU: 0 PID: 40 Comm: irq/38-pcf85063 Not tainted 6.1.27-6.3.0-devel+git.ca48fc16c493 #1
[ 87.430649] Hardware name: Freescale i.MX6 Ultralite (Device Tree)
[ 87.436870] unwind_backtrace from show_stack+0x10/0x14
[ 87.442171] show_stack from dump_stack_lvl+0x40/0x4c
[ 87.447288] dump_stack_lvl from __report_bad_irq+0x30/0xc0
[ 87.452929] __report_bad_irq from note_interrupt+0x284/0x2e0
[ 87.458731] note_interrupt from handle_irq_event+0x8c/0x90
[ 87.464363] handle_irq_event from handle_level_irq+0xb0/0x1b0
[ 87.470257] handle_level_irq from generic_handle_domain_irq+0x24/0x34
[ 87.476841] generic_handle_domain_irq from mxc_gpio_irq_handler+0x24/0x17c
[ 87.483872] mxc_gpio_irq_handler from mx3_gpio_irq_handler+0x5c/0xa8
[ 87.490370] mx3_gpio_irq_handler from generic_handle_domain_irq+0x24/0x34
[ 87.497306] generic_handle_domain_irq from gic_handle_irq+0x6c/0x90
[ 87.503726] gic_handle_irq from generic_handle_arch_irq+0x2c/0x44
[ 87.509973] generic_handle_arch_irq from call_with_stack+0x18/0x20
[ 87.516308] call_with_stack from __irq_svc+0x98/0xb4
[ 87.521406] Exception stack(0xd0a8ded8 to 0xd0a8df20)
[ 87.526490] dec0: c41c9c40 00000000
[ 87.534707] dee0: 00000000 000093eb c41d0b00 c4556640 00000000 c41d0b18 c41d0b6c c41d0b00
[ 87.542924] df00: c4556640 c1105150 c42e4600 d0a8df28 c017e5e4 c0178150 60030113 ffffffff
[ 87.551130] __irq_svc from irq_finalize_oneshot.part.0+0xa0/0x130
[ 87.557375] irq_finalize_oneshot.part.0 from irq_thread_fn+0x6c/0x78
[ 87.563887] irq_thread_fn from irq_thread+0x1b8/0x2ec
[ 87.569096] irq_thread from kthread+0xc8/0xe8
[ 87.573611] kthread from ret_from_fork+0x14/0x2c
[ 87.578367] Exception stack(0xd0a8dfb0 to 0xd0a8dff8)
[ 87.583450] dfa0: 00000000 00000000 00000000 00000000
[ 87.591663] dfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 87.599874] dfe0: 00000000 00000000 00000000 00000000 00000013 00000000
[ 87.606515] handlers:
[ 87.608809] [<629660f3>] irq_default_primary_handler threaded [<875225b4>] pcf85063_rtc_handle_irq
[ 87.617863] Disabling IRQ #38

And then I can’t change the /sys/power/state. For example, If I apply the rtcwake -u -s 60 -m mem command, I get:
[ 891.440577] PM: suspend entry (deep)
[ 891.453042] Filesystems sync: 0.008 seconds
[ 891.461101] Freezing user space processes
[ 891.467330] Freezing user space processes completed (elapsed 0.002 seconds)
[ 891.474896] OOM killer disabled.
[ 891.478286] Freezing remaining freezable tasks
[ 891.486742] Freezing remaining freezable tasks completed (elapsed 0.003 seconds)
[ 891.494355] printk: Suspending console(s) (use no_console_suspend to debug)
[ 891.546443] PM: suspend devices took 0.040 seconds
[ 891.550538] Disabling non-boot CPUs …
[ 891.754585] PM: resume devices took 0.200 seconds
[ 891.768192] OOM killer enabled.
[ 891.771354] Restarting tasks … done.
[ 891.791707] random: crng reseeded on system resumption
[ 891.796918] PM: suspend exit
rtcwake: write error

Am I missing something?

Hi @bjlli ,

The modifications you did seems correct. Can you please share the entire dmesg?

Best regards,
Daniel Morais

Hi, @daniel_m.tx .

Sure, the dmesg is attached below:
dmesg.txt (29.3 KB)

Thank you,
Brenda.

Hi @bjlli ,

Thanks for the dmesg!

I took a look into it and it seems that the RTC is being registered without issues:

[    8.216477] rtc-pcf85063 0-0051: registered as rtc0
[    8.228789] rtc-pcf85063 0-0051: setting system clock to 2022-04-29T23:00:28 UTC (1651273228)

Also on the documentation provided on the kernel, there is no info about the INT signal, can you verify if it’s working without the definition of the interrupt PIN on device tree?

Best regards,
Daniel Morais

@daniel_m.tx,

In fact, the rtc works fine except by the fact that I can’t use it as a wake up pin.

I followed this documentation to register the interrupt pin in the device node. But, you correctly pointed that the INT signal isn’t mapped in Toradex kernel documentation. Maybe it isn’t supported yet?

Regards,

Brenda.

Hi @bjlli ,

Good to hear that the RTC is working fine!

In fact, it seems it is supported on the driver code, where you can see the enable function here, but it seems that it isn’t using the device-tree to configure this pin. This NXP documentation also has some information about these RTC features, you can take a look into this in the 3.1 Event counter mode topic.

Best regards,
Daniel Morais