Skip to contentSkip to conversation

Enable RTC on Odroid N2

PATCH Superseded Anand Moon 4 participants 17 messages Jul 15, 2020 – Jul 16, 2020

Subsystems (2)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Anand Moon

author
#0 lore raw

cover Enable RTC on Odroid N2

Inoder for test suspend resume feature on Odroid N2 we need to enable RTC module on this device.

Following patches enable rtc on Odroid N2 but sill rtcwakeup is not working se bellow. Any inputs are welcome.

# sudo hwclock -r && date
2020-07-15 15:53:27.706883+00:00
Wed Jul 15 15:53:27 UTC 2020
# echo 1 > /sys/power/pm_debug_messages
bash: /sys/power/pm_debug_messages: Permission denied
# time rtcwake -s 30 -m mem
rtcwake: /dev/rtc0 not enabled for wakeup events
real    0m0.003s
user    0m0.003s
sys     0m0.000s

#

-Anand

Anand Moon (3):
arm64: dts: meson-g12b-odroid-n2: Enable RTC controller node
arm64: dts: meson-g12b-odroid-n2: Disable virtual wake RTC
arm64: defconfig: Enable RTC devices for Amlogic boards

 .../boot/dts/amlogic/meson-g12b-odroid-n2.dts  | 18 ++++++++++++++++++
 arch/arm64/configs/defconfig                   |  1 +
 2 files changed, 19 insertions(+)
Signature · 7 lines
2.27.0


_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
author
#1 lore raw

PATCH 1/3 arm64: dts: meson-g12b-odroid-n2: Enable RTC controller node

Enable RTC PCF8563 node on Odroid-N2 SBC, In order to support the RTC wakealarm feature for suspend and resume.

Cc Neil Armstrong <[email protected]>
Cc Kevin Hilman <[email protected]>

---

$ sudo hwclock -r && date
2020-07-15 13:11:53.862508+00:00
Wed Jul 15 13:11:54 UTC 2020
$ hwclock --show
2020-07-15 13:17:30.903300+00:00

But RTC wake up is not working at my end. Any inputs are welcome.

$ time rtcwake -s 30 -m mem
rtcwake: /dev/rtc0 not enabled for wakeup events
real    0m0.002s
user    0m0.002s
sys     0m0.000s
---
 .../boot/dts/amlogic/meson-g12b-odroid-n2.dts      | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts +14 -0
index 169ea283d4ee..a447cba4dd53 100644
@@ -391,6 +391,20 @@ hdmi_tx_tmds_out: endpoint {
 	};
 };
 
+&i2c3 {
+	pinctrl-0 = <&i2c3_sda_a_pins>, <&i2c3_sck_a_pins>;
+	pinctrl-names = "default";
+	status = "okay";
+
+	rtc: rtc@51 {
+		reg = <0x51>;
+		compatible = "nxp,pcf8563";
+		#clock-cells = <0>;
+		clock-frequency = <32768>;
+		clock-output-names = "rtc_clkout";
+	};
+};
+
 &ir {
 	status = "okay";
 	pinctrl-0 = <&remote_input_ao_pins>;
Signature · 7 lines
2.27.0


_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
author
#6 lore raw

PATCH 2/3 arm64: dts: meson-g12b-odroid-n2: Disable virtual wake RTC

In reply to Anand Moon

Disable virtual wake RTC node on Odroid N2.

[    7.171149] meson-vrtc ff8000a8.rtc: registered as rtc0
[    7.182875] meson-vrtc ff8000a8.rtc: setting system clock to 1970-01-01T00:00:07 UTC (7)
Cc Neil Armstrong <[email protected]>
Cc Kevin Hilman <[email protected]>

---

---
 arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts +4 -0
index a447cba4dd53..c8c1262a7bfc 100644
@@ -517,3 +517,7 @@ &usb2_phy1 {
 	/* Enable the hub which is connected to this port */
 	phy-supply = <&hub_5v>;
 };
+
+&vrtc {
+	status = "disabled";
+};
Signature · 7 lines
2.27.0


_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
author
#9 lore raw

PATCH 3/3 arm64: defconfig: Enable RTC devices for Amlogic boards

In reply to Anand Moon

Enables the RTC PCF8563 driver used on Amlogic Libretech-pc and Odroid-N2 boards supported in mainline kernel.

---
 arch/arm64/configs/defconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/configs/defconfig +1 -0
index 883e8bace3ed..a0e8d46c3d06 100644
@@ -750,6 +750,7 @@ CONFIG_RTC_DRV_DS1307=m
 CONFIG_RTC_DRV_MAX77686=y
 CONFIG_RTC_DRV_RK808=m
 CONFIG_RTC_DRV_PCF85363=m
+CONFIG_RTC_DRV_PCF8563=m
 CONFIG_RTC_DRV_RX8581=m
 CONFIG_RTC_DRV_S5M=y
 CONFIG_RTC_DRV_DS3232=y
Signature · 7 lines
2.27.0


_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
#11 lore raw
In reply to Anand Moon

Hi Anand,

Only the vrtc is able to wakeup the device from suspend, the external RTC is not capable.

Neil

Quoted 32 lines · Anand Moon

Inoder for test suspend resume feature on Odroid N2 we need to enable RTC module on this device.

Following patches enable rtc on Odroid N2 but sill rtcwakeup is not working se bellow. Any inputs are welcome.

# sudo hwclock -r && date
2020-07-15 15:53:27.706883+00:00
Wed Jul 15 15:53:27 UTC 2020
# echo 1 > /sys/power/pm_debug_messages
bash: /sys/power/pm_debug_messages: Permission denied
# time rtcwake -s 30 -m mem
rtcwake: /dev/rtc0 not enabled for wakeup events
real    0m0.003s
user    0m0.003s
sys     0m0.000s

#

-Anand

Anand Moon (3):
arm64: dts: meson-g12b-odroid-n2: Enable RTC controller node
arm64: dts: meson-g12b-odroid-n2: Disable virtual wake RTC
arm64: defconfig: Enable RTC devices for Amlogic boards

 .../boot/dts/amlogic/meson-g12b-odroid-n2.dts  | 18 ++++++++++++++++++
 arch/arm64/configs/defconfig                   |  1 +
 2 files changed, 19 insertions(+)
#7 lore raw

Re: [PATCHv1 2/3] arm64: dts: meson-g12b-odroid-n2: Disable virtual wake RTC

In reply to Anand Moon

Hi,

Quoted 19 lines · Anand Moon

Disable virtual wake RTC node on Odroid N2.

[    7.171149] meson-vrtc ff8000a8.rtc: registered as rtc0
[    7.182875] meson-vrtc ff8000a8.rtc: setting system clock to 1970-01-01T00:00:07 UTC (7)
Cc Neil Armstrong <[email protected]>
Cc Kevin Hilman <[email protected]>

---

---
 arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts +0 -0
index a447cba4dd53..c8c1262a7bfc 100644

arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts &usb2_phy1 { · line 523

Quoted 7 lines
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts +4 -0
@@ -517,3 +517,7 @@ &usb2_phy1 {
 	/* Enable the hub which is connected to this port */
 	phy-supply = <&hub_5v>;
 };
+
+&vrtc {
+	status = "disabled";
+};

Please don't, the vrtc is here to wake up the device.

Neil

#2 lore raw

Re: [PATCHv1 1/3] arm64: dts: meson-g12b-odroid-n2: Enable RTC controller node

In reply to Anand Moon

Hi,

Quoted 36 lines · Anand Moon

Enable RTC PCF8563 node on Odroid-N2 SBC, In order to support the RTC wakealarm feature for suspend and resume.

Cc Neil Armstrong <[email protected]>
Cc Kevin Hilman <[email protected]>

---

$ sudo hwclock -r && date
2020-07-15 13:11:53.862508+00:00
Wed Jul 15 13:11:54 UTC 2020
$ hwclock --show
2020-07-15 13:17:30.903300+00:00

But RTC wake up is not working at my end. Any inputs are welcome.

$ time rtcwake -s 30 -m mem
rtcwake: /dev/rtc0 not enabled for wakeup events
real    0m0.002s
user    0m0.002s
sys     0m0.000s
---
 .../boot/dts/amlogic/meson-g12b-odroid-n2.dts      | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts +1 -0
index 169ea283d4ee..a447cba4dd53 100644
@@ -391,6 +391,20 @@ hdmi_tx_tmds_out: endpoint {
 	};
 };
 
+&i2c3 {

arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts hdmi_tx_tmds_out: endpoint { · line 404

Quoted 10 lines
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts +10 -0
+	pinctrl-0 = <&i2c3_sda_a_pins>, <&i2c3_sck_a_pins>;
+	pinctrl-names = "default";
+	status = "okay";
+
+	rtc: rtc@51 {
+		reg = <0x51>;
+		compatible = "nxp,pcf8563";
+		#clock-cells = <0>;
+		clock-frequency = <32768>;
+		clock-output-names = "rtc_clkout";

The clkout output is not used, so I don't think these 3 lines are needed.

arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts hdmi_tx_tmds_out: endpoint { · line 410

Quoted 7 lines
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts +3 -0
+	};
+};
+
 &ir {
 	status = "okay";
 	pinctrl-0 = <&remote_input_ao_pins>;

Neil

Acked-by on v1 3/3
#10 lore raw

Re: [PATCHv1 3/3] arm64: defconfig: Enable RTC devices for Amlogic boards

In reply to Anand Moon
Quoted 15 lines · Anand Moon

Enables the RTC PCF8563 driver used on Amlogic Libretech-pc and Odroid-N2 boards supported in mainline kernel.

---
 arch/arm64/configs/defconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/configs/defconfig +0 -0
index 883e8bace3ed..a0e8d46c3d06 100644

arch/arm64/configs/defconfig CONFIG_RTC_DRV_DS1307=m · line 756

Quoted 7 lines
arch/arm64/configs/defconfig +1 -0
@@ -750,6 +750,7 @@ CONFIG_RTC_DRV_DS1307=m
 CONFIG_RTC_DRV_MAX77686=y
 CONFIG_RTC_DRV_RK808=m
 CONFIG_RTC_DRV_PCF85363=m
+CONFIG_RTC_DRV_PCF8563=m
 CONFIG_RTC_DRV_RX8581=m
 CONFIG_RTC_DRV_S5M=y
 CONFIG_RTC_DRV_DS3232=y
author
#8 lore raw

Re: [PATCHv1 2/3] arm64: dts: meson-g12b-odroid-n2: Disable virtual wake RTC

In reply to Neil Armstrong

Hi Neil,

Thanks for your review comments.

Quoted 33 lines · Neil Armstrong

Hi,

Quoted 19 lines · Anand Moon

Disable virtual wake RTC node on Odroid N2.

[    7.171149] meson-vrtc ff8000a8.rtc: registered as rtc0
[    7.182875] meson-vrtc ff8000a8.rtc: setting system clock to 1970-01-01T00:00:07 UTC (7)
Cc Neil Armstrong <[email protected]>
Cc Kevin Hilman <[email protected]>

---

---
 arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts +0 -0
index a447cba4dd53..c8c1262a7bfc 100644

arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts &usb2_phy1 { · line 523

Quoted 7 lines
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts +4 -0
@@ -517,3 +517,7 @@ &usb2_phy1 {
      /* Enable the hub which is connected to this port */
      phy-supply = <&hub_5v>;
 };
+
+&vrtc {
+     status = "disabled";
+};

Please don't, the vrtc is here to wake up the device.

Quoted 1 line

Neil

Ok, I thought that there would be conflicts with the RTC module, that's why I disable this node. I will drop this patch.

-Anand

author
#3 lore raw

Re: [PATCHv1 1/3] arm64: dts: meson-g12b-odroid-n2: Enable RTC controller node

In reply to Neil Armstrong

Hi Neil,

Thanks for your review comments.

Quoted 39 lines · Neil Armstrong

Hi,

Quoted 35 lines · Anand Moon

Enable RTC PCF8563 node on Odroid-N2 SBC, In order to support the RTC wakealarm feature for suspend and resume.

Cc Neil Armstrong <[email protected]>
Cc Kevin Hilman <[email protected]>

---

$ sudo hwclock -r && date
2020-07-15 13:11:53.862508+00:00
Wed Jul 15 13:11:54 UTC 2020
$ hwclock --show
2020-07-15 13:17:30.903300+00:00

But RTC wake up is not working at my end. Any inputs are welcome.

$ time rtcwake -s 30 -m mem
rtcwake: /dev/rtc0 not enabled for wakeup events
real    0m0.002s
user    0m0.002s
sys     0m0.000s
---
 .../boot/dts/amlogic/meson-g12b-odroid-n2.dts      | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts +0 -0
index 169ea283d4ee..a447cba4dd53 100644
@@ -391,6 +391,20 @@ hdmi_tx_tmds_out: endpoint {
      };
 };
 
Quoted 13 lines

arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts hdmi_tx_tmds_out: endpoint { · line 404

Quoted 11 lines
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts +11 -0
+&i2c3 {
+     pinctrl-0 = <&i2c3_sda_a_pins>, <&i2c3_sck_a_pins>;
+     pinctrl-names = "default";
+     status = "okay";
+
+     rtc: rtc@51 {
+             reg = <0x51>;
+             compatible = "nxp,pcf8563";
+             #clock-cells = <0>;
+             clock-frequency = <32768>;
+             clock-output-names = "rtc_clkout";

The clkout output is not used, so I don't think these 3 lines are needed.

Ok Thanks I will drop these 3 clock lines.

Quoted 10 lines

arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts hdmi_tx_tmds_out: endpoint { · line 410

Quoted 8 lines
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts +3 -0
+     };
+};
+
 &ir {
      status = "okay";
      pinctrl-0 = <&remote_input_ao_pins>;

Neil

-Anand

reviewer
#4 lore raw

Re: [PATCHv1 1/3] arm64: dts: meson-g12b-odroid-n2: Enable RTC controller node

In reply to Anand Moon
Quoted 37 lines · Anand Moon

Enable RTC PCF8563 node on Odroid-N2 SBC, In order to support the RTC wakealarm feature for suspend and resume.

Cc Neil Armstrong <[email protected]>
Cc Kevin Hilman <[email protected]>

---

$ sudo hwclock -r && date
2020-07-15 13:11:53.862508+00:00
Wed Jul 15 13:11:54 UTC 2020
$ hwclock --show
2020-07-15 13:17:30.903300+00:00

But RTC wake up is not working at my end. Any inputs are welcome.

$ time rtcwake -s 30 -m mem
rtcwake: /dev/rtc0 not enabled for wakeup events
real    0m0.002s
user    0m0.002s
sys     0m0.000s
---
 .../boot/dts/amlogic/meson-g12b-odroid-n2.dts      | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts +2 -0
index 169ea283d4ee..a447cba4dd53 100644
@@ -391,6 +391,20 @@ hdmi_tx_tmds_out: endpoint {
 	};
 };
 
+&i2c3 {
+	pinctrl-0 = <&i2c3_sda_a_pins>, <&i2c3_sck_a_pins>;

arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts hdmi_tx_tmds_out: endpoint { · line 405

Quoted 10 lines
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts +10 -0
+	pinctrl-names = "default";
+	status = "okay";
+
+	rtc: rtc@51 {
+		reg = <0x51>;
+		compatible = "nxp,pcf8563";
+		#clock-cells = <0>;
+		clock-frequency = <32768>;
+		clock-output-names = "rtc_clkout";
+	};

This rtc being on a connector, optional and not fitted by default, should it really be enabled for all odroid-n2 ?

We tend not do that usually

Quoted 5 lines
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts +2 -0
+};
+
 &ir {
 	status = "okay";
 	pinctrl-0 = <&remote_input_ao_pins>;
author
#12 lore raw
In reply to Neil Armstrong

Hi Neil,

Thanks for your review comments.

Quoted 7 lines · Neil Armstrong

Hi Anand,

Only the vrtc is able to wakeup the device from suspend, the external RTC is not capable.

Neil

Now I have two RTC driver registered

$ dmesg | grep rtc
[    4.737315] rtc-pcf8563 0-0051: registered as rtc0
[    4.738763] rtc-pcf8563 0-0051: setting system clock to
2020-07-16T08:00:46 UTC (1594886446)
[    4.790206] meson-vrtc ff8000a8.rtc: registered as rtc1

And there are two nodes

# ls /dev/rtc*
/dev/rtc  /dev/rtc0  /dev/rtc1

So it seames an issue that /dev/rtc0 is not able to handle wakeup events. How can we resolve this issue?

# time rtcwake -s 30 -m mem
rtcwake: /dev/rtc0 not enabled for wakeup events
real    0m0.002s
user    0m0.001s
sys     0m0.002s

-Anand

#13 lore raw

Hi,

Quoted 22 lines · Anand Moon

Hi Neil,

Thanks for your review comments.

Quoted 7 lines · Neil Armstrong

Hi Anand,

Only the vrtc is able to wakeup the device from suspend, the external RTC is not capable.

Neil

Now I have two RTC driver registered

$ dmesg | grep rtc
[    4.737315] rtc-pcf8563 0-0051: registered as rtc0
[    4.738763] rtc-pcf8563 0-0051: setting system clock to
2020-07-16T08:00:46 UTC (1594886446)
[    4.790206] meson-vrtc ff8000a8.rtc: registered as rtc1

And there are two nodes

Quoted 8 lines
# ls /dev/rtc*
/dev/rtc  /dev/rtc0  /dev/rtc1

So it seames an issue that /dev/rtc0 is not able to handle wakeup events. How can we resolve this issue?

# time rtcwake -s 30 -m mem
rtcwake: /dev/rtc0 not enabled for wakeup events

rtcwake -d /dev/rtc1 -s 30 -m mem

As Christian reported off-list, it may be necessary to keep the vrtc as rtc0, so you should add aliases in the odroid-n2 DT to have vrtc as rtc0 and the on-board rtc as rtc1, but it may break the hwclock tools, so the reverse may be better but you'll need to specify rtc1 to rtcwake.

Neil

Quoted 7 lines
real    0m0.002s
user    0m0.001s
sys     0m0.002s

-Anand

#14 lore raw

Hi,

Quoted 34 lines · Neil Armstrong

Hi,

Quoted 22 lines · Anand Moon

Hi Neil,

Thanks for your review comments.

Quoted 7 lines · Neil Armstrong

Hi Anand,

Only the vrtc is able to wakeup the device from suspend, the external RTC is not capable.

Neil

Now I have two RTC driver registered

$ dmesg | grep rtc
[    4.737315] rtc-pcf8563 0-0051: registered as rtc0
[    4.738763] rtc-pcf8563 0-0051: setting system clock to
2020-07-16T08:00:46 UTC (1594886446)
[    4.790206] meson-vrtc ff8000a8.rtc: registered as rtc1

And there are two nodes

Quoted 8 lines
# ls /dev/rtc*
/dev/rtc  /dev/rtc0  /dev/rtc1

So it seames an issue that /dev/rtc0 is not able to handle wakeup events. How can we resolve this issue?

# time rtcwake -s 30 -m mem
rtcwake: /dev/rtc0 not enabled for wakeup events
Quoted 6 lines

rtcwake -d /dev/rtc1 -s 30 -m mem

As Christian reported off-list, it may be necessary to keep the vrtc as rtc0, so you should add aliases in the odroid-n2 DT to have vrtc as rtc0 and the on-board rtc as rtc1, but it may break the hwclock tools, so the reverse may be better but you'll need to specify rtc1 to rtcwake.

While looking closer to the Odroid-N2 schematics and U-Boot/SCP Firmware, the external on-board RTC can wake the device with the GPIO_AO 7, and wakeup is enabled in:
https://github.com/hardkernel/u-boot/blob/odroidn2-v2015.01/board/hardkernel/odroidn2/firmware/scp_task/pwr_ctrl.c#L143

So, something must be missing.

Neil

Quoted 11 lines

Neil

Quoted 7 lines
real    0m0.002s
user    0m0.001s
sys     0m0.002s

-Anand

author
#5 lore raw

Re: [PATCHv1 1/3] arm64: dts: meson-g12b-odroid-n2: Enable RTC controller node

In reply to Jerome Brunet

Hi Jerome,

Thanks for your review comments.

Quoted 55 lines · Jerome Brunet
Quoted 37 lines · Anand Moon

Enable RTC PCF8563 node on Odroid-N2 SBC, In order to support the RTC wakealarm feature for suspend and resume.

Cc Neil Armstrong <[email protected]>
Cc Kevin Hilman <[email protected]>

---

$ sudo hwclock -r && date
2020-07-15 13:11:53.862508+00:00
Wed Jul 15 13:11:54 UTC 2020
$ hwclock --show
2020-07-15 13:17:30.903300+00:00

But RTC wake up is not working at my end. Any inputs are welcome.

$ time rtcwake -s 30 -m mem
rtcwake: /dev/rtc0 not enabled for wakeup events
real    0m0.002s
user    0m0.002s
sys     0m0.000s
---
 .../boot/dts/amlogic/meson-g12b-odroid-n2.dts      | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts +2 -0
index 169ea283d4ee..a447cba4dd53 100644
@@ -391,6 +391,20 @@ hdmi_tx_tmds_out: endpoint {
      };
 };
 
+&i2c3 {
+     pinctrl-0 = <&i2c3_sda_a_pins>, <&i2c3_sck_a_pins>;

arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts hdmi_tx_tmds_out: endpoint { · line 405

Quoted 10 lines
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts +10 -0
+     pinctrl-names = "default";
+     status = "okay";
+
+     rtc: rtc@51 {
+             reg = <0x51>;
+             compatible = "nxp,pcf8563";
+             #clock-cells = <0>;
+             clock-frequency = <32768>;
+             clock-output-names = "rtc_clkout";
+     };

This rtc being on a connector, optional and not fitted by default, should it really be enabled for all odroid-n2 ?

Quoted 1 line

We tend not do that usually

My thought process was there will be an Internal primary interrupt pin that handles
RTC wakeup and is connected to the CPU and IO peripherals..

-Anand

author
#15 lore raw
In reply to Neil Armstrong

hi Neil,

Quoted 45 lines · Neil Armstrong

Hi,

Quoted 34 lines · Neil Armstrong

Hi,

Quoted 22 lines · Anand Moon

Hi Neil,

Thanks for your review comments.

Quoted 7 lines · Neil Armstrong

Hi Anand,

Only the vrtc is able to wakeup the device from suspend, the external RTC is not capable.

Neil

Now I have two RTC driver registered

$ dmesg | grep rtc
[    4.737315] rtc-pcf8563 0-0051: registered as rtc0
[    4.738763] rtc-pcf8563 0-0051: setting system clock to
2020-07-16T08:00:46 UTC (1594886446)
[    4.790206] meson-vrtc ff8000a8.rtc: registered as rtc1

And there are two nodes

Quoted 8 lines
# ls /dev/rtc*
/dev/rtc  /dev/rtc0  /dev/rtc1

So it seames an issue that /dev/rtc0 is not able to handle wakeup events. How can we resolve this issue?

# time rtcwake -s 30 -m mem
rtcwake: /dev/rtc0 not enabled for wakeup events
Quoted 6 lines

rtcwake -d /dev/rtc1 -s 30 -m mem

As Christian reported off-list, it may be necessary to keep the vrtc as rtc0, so you should add aliases in the odroid-n2 DT to have vrtc as rtc0 and the on-board rtc as rtc1, but it may break the hwclock tools, so the reverse may be better but you'll need to specify rtc1 to rtcwake.

Quoted 6 lines

While looking closer to the Odroid-N2 schematics and U-Boot/SCP Firmware, the external on-board RTC can wake the device with the GPIO_AO 7, and wakeup is enabled in:
https://github.com/hardkernel/u-boot/blob/odroidn2-v2015.01/board/hardkernel/odroidn2/firmware/scp_task/pwr_ctrl.c#L143

So, something must be missing.

Ok I have missed this setting.
But I could not find any more information on this configuration in S922X_Public_Datasheet_V0.2-Hardkernel,

But HK uses the same set up as we do.
https://github.com/hardkernel/linux/blob/odroidn2-4.9.y/arch/arm64/boot/dts/amlogic/mesong12_odroid_common.dtsi#L322-L333
I could not gather much input from this configration.

Does VIM3 support VRTC or do they prefer rtc wakeup via RTC ?

-Anand

maintainer
#16 lore raw
In reply to Neil Armstrong
Quoted 44 lines · Neil Armstrong

Hi,

Quoted 34 lines · Neil Armstrong

Hi,

Quoted 22 lines · Anand Moon

Hi Neil,

Thanks for your review comments.

Quoted 7 lines · Neil Armstrong

Hi Anand,

Only the vrtc is able to wakeup the device from suspend, the external RTC is not capable.

Neil

Now I have two RTC driver registered

$ dmesg | grep rtc
[    4.737315] rtc-pcf8563 0-0051: registered as rtc0
[    4.738763] rtc-pcf8563 0-0051: setting system clock to
2020-07-16T08:00:46 UTC (1594886446)
[    4.790206] meson-vrtc ff8000a8.rtc: registered as rtc1

And there are two nodes

Quoted 8 lines
# ls /dev/rtc*
/dev/rtc  /dev/rtc0  /dev/rtc1

So it seames an issue that /dev/rtc0 is not able to handle wakeup events. How can we resolve this issue?

# time rtcwake -s 30 -m mem
rtcwake: /dev/rtc0 not enabled for wakeup events
Quoted 6 lines

rtcwake -d /dev/rtc1 -s 30 -m mem

As Christian reported off-list, it may be necessary to keep the vrtc as rtc0, so you should add aliases in the odroid-n2 DT to have vrtc as rtc0 and the on-board rtc as rtc1, but it may break the hwclock tools, so the reverse may be better but you'll need to specify rtc1 to rtcwake.

Quoted 5 lines

While looking closer to the Odroid-N2 schematics and U-Boot/SCP Firmware, the external on-board RTC can wake the device with the GPIO_AO 7, and wakeup is enabled in:
https://github.com/hardkernel/u-boot/blob/odroidn2-v2015.01/board/hardkernel/odroidn2/firmware/scp_task/pwr_ctrl.c#L143

So, something must be missing.

A couple possibilities come to mind (without looking at the specific RTC driver):

1) pinctrl for that GPIO needs proper settings
2) DT node for the RTC needs "wakeup-source" property

Kevin