linux-amlogic.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv1 0/3] Enable RTC on Odroid N2
@ 2020-07-15 16:02 Anand Moon
  2020-07-15 16:02 ` [PATCHv1 1/3] arm64: dts: meson-g12b-odroid-n2: Enable RTC controller node Anand Moon
                   ` (3 more replies)
  0 siblings, 4 replies; 17+ messages in thread
From: Anand Moon @ 2020-07-15 16:02 UTC (permalink / raw)
  To: devicetree, linux-arm-kernel, linux-amlogic
  Cc: Mark Rutland, Neil Armstrong, Martin Blumenstingl, Kevin Hilman,
	Rob Herring, Jerome Brunet

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(+)

-- 
2.27.0


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCHv1 1/3] arm64: dts: meson-g12b-odroid-n2: Enable RTC controller node
  2020-07-15 16:02 [PATCHv1 0/3] Enable RTC on Odroid N2 Anand Moon
@ 2020-07-15 16:02 ` Anand Moon
  2020-07-16  7:08   ` Neil Armstrong
  2020-07-16  8:08   ` Jerome Brunet
  2020-07-15 16:02 ` [PATCHv1 2/3] arm64: dts: meson-g12b-odroid-n2: Disable virtual wake RTC Anand Moon
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 17+ messages in thread
From: Anand Moon @ 2020-07-15 16:02 UTC (permalink / raw)
  To: devicetree, linux-arm-kernel, linux-amlogic
  Cc: Mark Rutland, Neil Armstrong, Martin Blumenstingl, Kevin Hilman,
	Rob Herring, Jerome Brunet

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

Cc: Neil Armstrong <narmstrong@baylibre.com>
Cc: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Anand Moon <linux.amoon@gmail.com>
---
$ 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(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
index 169ea283d4ee..a447cba4dd53 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
@@ -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>;
-- 
2.27.0


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCHv1 2/3] arm64: dts: meson-g12b-odroid-n2: Disable virtual wake RTC
  2020-07-15 16:02 [PATCHv1 0/3] Enable RTC on Odroid N2 Anand Moon
  2020-07-15 16:02 ` [PATCHv1 1/3] arm64: dts: meson-g12b-odroid-n2: Enable RTC controller node Anand Moon
@ 2020-07-15 16:02 ` Anand Moon
  2020-07-16  7:05   ` Neil Armstrong
  2020-07-15 16:02 ` [PATCHv1 3/3] arm64: defconfig: Enable RTC devices for Amlogic boards Anand Moon
  2020-07-16  7:05 ` [PATCHv1 0/3] Enable RTC on Odroid N2 Neil Armstrong
  3 siblings, 1 reply; 17+ messages in thread
From: Anand Moon @ 2020-07-15 16:02 UTC (permalink / raw)
  To: devicetree, linux-arm-kernel, linux-amlogic
  Cc: Mark Rutland, Neil Armstrong, Martin Blumenstingl, Kevin Hilman,
	Rob Herring, Jerome Brunet

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 <narmstrong@baylibre.com>
Cc: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Anand Moon <linux.amoon@gmail.com>
---
---
 arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
index a447cba4dd53..c8c1262a7bfc 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
@@ -517,3 +517,7 @@ &usb2_phy1 {
 	/* Enable the hub which is connected to this port */
 	phy-supply = <&hub_5v>;
 };
+
+&vrtc {
+	status = "disabled";
+};
-- 
2.27.0


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCHv1 3/3] arm64: defconfig: Enable RTC devices for Amlogic boards
  2020-07-15 16:02 [PATCHv1 0/3] Enable RTC on Odroid N2 Anand Moon
  2020-07-15 16:02 ` [PATCHv1 1/3] arm64: dts: meson-g12b-odroid-n2: Enable RTC controller node Anand Moon
  2020-07-15 16:02 ` [PATCHv1 2/3] arm64: dts: meson-g12b-odroid-n2: Disable virtual wake RTC Anand Moon
@ 2020-07-15 16:02 ` Anand Moon
  2020-07-16  7:08   ` Neil Armstrong
  2020-07-16  7:05 ` [PATCHv1 0/3] Enable RTC on Odroid N2 Neil Armstrong
  3 siblings, 1 reply; 17+ messages in thread
From: Anand Moon @ 2020-07-15 16:02 UTC (permalink / raw)
  To: devicetree, linux-arm-kernel, linux-amlogic
  Cc: Mark Rutland, Neil Armstrong, Martin Blumenstingl, Kevin Hilman,
	Rob Herring, Jerome Brunet

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

Cc: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Anand Moon <linux.amoon@gmail.com>
---
 arch/arm64/configs/defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index 883e8bace3ed..a0e8d46c3d06 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -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
-- 
2.27.0


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCHv1 0/3] Enable RTC on Odroid N2
  2020-07-15 16:02 [PATCHv1 0/3] Enable RTC on Odroid N2 Anand Moon
                   ` (2 preceding siblings ...)
  2020-07-15 16:02 ` [PATCHv1 3/3] arm64: defconfig: Enable RTC devices for Amlogic boards Anand Moon
@ 2020-07-16  7:05 ` Neil Armstrong
  2020-07-16  8:14   ` Anand Moon
  3 siblings, 1 reply; 17+ messages in thread
From: Neil Armstrong @ 2020-07-16  7:05 UTC (permalink / raw)
  To: Anand Moon, devicetree, linux-arm-kernel, linux-amlogic
  Cc: Mark Rutland, Kevin Hilman, Rob Herring, Martin Blumenstingl,
	Jerome Brunet

Hi Anand,

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

Neil

On 15/07/2020 18:02, Anand Moon wrote:
> 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(+)
> 


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCHv1 2/3] arm64: dts: meson-g12b-odroid-n2: Disable virtual wake RTC
  2020-07-15 16:02 ` [PATCHv1 2/3] arm64: dts: meson-g12b-odroid-n2: Disable virtual wake RTC Anand Moon
@ 2020-07-16  7:05   ` Neil Armstrong
  2020-07-16  7:19     ` Anand Moon
  0 siblings, 1 reply; 17+ messages in thread
From: Neil Armstrong @ 2020-07-16  7:05 UTC (permalink / raw)
  To: Anand Moon, devicetree, linux-arm-kernel, linux-amlogic
  Cc: Mark Rutland, Kevin Hilman, Rob Herring, Martin Blumenstingl,
	Jerome Brunet

Hi,

On 15/07/2020 18:02, Anand Moon wrote:
> 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 <narmstrong@baylibre.com>
> Cc: Kevin Hilman <khilman@baylibre.com>
> Signed-off-by: Anand Moon <linux.amoon@gmail.com>
> ---
> ---
>  arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
> index a447cba4dd53..c8c1262a7bfc 100644
> --- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
> +++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
> @@ -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

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCHv1 1/3] arm64: dts: meson-g12b-odroid-n2: Enable RTC controller node
  2020-07-15 16:02 ` [PATCHv1 1/3] arm64: dts: meson-g12b-odroid-n2: Enable RTC controller node Anand Moon
@ 2020-07-16  7:08   ` Neil Armstrong
  2020-07-16  8:02     ` Anand Moon
  2020-07-16  8:08   ` Jerome Brunet
  1 sibling, 1 reply; 17+ messages in thread
From: Neil Armstrong @ 2020-07-16  7:08 UTC (permalink / raw)
  To: Anand Moon, devicetree, linux-arm-kernel, linux-amlogic
  Cc: Mark Rutland, Kevin Hilman, Rob Herring, Martin Blumenstingl,
	Jerome Brunet

Hi,

On 15/07/2020 18:02, Anand Moon wrote:
> Enable RTC PCF8563 node on Odroid-N2 SBC, In order
> to support the RTC wakealarm feature for suspend and resume.
> 
> Cc: Neil Armstrong <narmstrong@baylibre.com>
> Cc: Kevin Hilman <khilman@baylibre.com>
> Signed-off-by: Anand Moon <linux.amoon@gmail.com>
> ---
> $ 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(+)
> 
> diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
> index 169ea283d4ee..a447cba4dd53 100644
> --- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
> +++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
> @@ -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";

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

> +	};
> +};
> +
>  &ir {
>  	status = "okay";
>  	pinctrl-0 = <&remote_input_ao_pins>;
> 

Neil

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCHv1 3/3] arm64: defconfig: Enable RTC devices for Amlogic boards
  2020-07-15 16:02 ` [PATCHv1 3/3] arm64: defconfig: Enable RTC devices for Amlogic boards Anand Moon
@ 2020-07-16  7:08   ` Neil Armstrong
  0 siblings, 0 replies; 17+ messages in thread
From: Neil Armstrong @ 2020-07-16  7:08 UTC (permalink / raw)
  To: Anand Moon, devicetree, linux-arm-kernel, linux-amlogic
  Cc: Mark Rutland, Kevin Hilman, Rob Herring, Martin Blumenstingl,
	Jerome Brunet

On 15/07/2020 18:02, Anand Moon wrote:
> Enables the RTC PCF8563 driver used on Amlogic Libretech-pc
> and Odroid-N2 boards supported in mainline kernel.
> 
> Cc: Kevin Hilman <khilman@baylibre.com>
> Signed-off-by: Anand Moon <linux.amoon@gmail.com>
> ---
>  arch/arm64/configs/defconfig | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
> index 883e8bace3ed..a0e8d46c3d06 100644
> --- a/arch/arm64/configs/defconfig
> +++ b/arch/arm64/configs/defconfig
> @@ -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
> 

Acked-by: Neil Armstrong <narmstrong@baylibre.com>

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCHv1 2/3] arm64: dts: meson-g12b-odroid-n2: Disable virtual wake RTC
  2020-07-16  7:05   ` Neil Armstrong
@ 2020-07-16  7:19     ` Anand Moon
  0 siblings, 0 replies; 17+ messages in thread
From: Anand Moon @ 2020-07-16  7:19 UTC (permalink / raw)
  To: Neil Armstrong
  Cc: Mark Rutland, devicetree, Martin Blumenstingl, Kevin Hilman,
	Rob Herring, linux-amlogic, linux-arm-kernel, Jerome Brunet

Hi Neil,

Thanks for your review comments.

On Thu, 16 Jul 2020 at 12:35, Neil Armstrong <narmstrong@baylibre.com> wrote:
>
> Hi,
>
> On 15/07/2020 18:02, Anand Moon wrote:
> > 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 <narmstrong@baylibre.com>
> > Cc: Kevin Hilman <khilman@baylibre.com>
> > Signed-off-by: Anand Moon <linux.amoon@gmail.com>
> > ---
> > ---
> >  arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
> > index a447cba4dd53..c8c1262a7bfc 100644
> > --- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
> > +++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
> > @@ -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

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

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCHv1 1/3] arm64: dts: meson-g12b-odroid-n2: Enable RTC controller node
  2020-07-16  7:08   ` Neil Armstrong
@ 2020-07-16  8:02     ` Anand Moon
  0 siblings, 0 replies; 17+ messages in thread
From: Anand Moon @ 2020-07-16  8:02 UTC (permalink / raw)
  To: Neil Armstrong
  Cc: Mark Rutland, devicetree, Martin Blumenstingl, Kevin Hilman,
	Rob Herring, linux-amlogic, linux-arm-kernel, Jerome Brunet

Hi Neil,

Thanks for your review comments.

On Thu, 16 Jul 2020 at 12:38, Neil Armstrong <narmstrong@baylibre.com> wrote:
>
> Hi,
>
> On 15/07/2020 18:02, Anand Moon wrote:
> > Enable RTC PCF8563 node on Odroid-N2 SBC, In order
> > to support the RTC wakealarm feature for suspend and resume.
> >
> > Cc: Neil Armstrong <narmstrong@baylibre.com>
> > Cc: Kevin Hilman <khilman@baylibre.com>
> > Signed-off-by: Anand Moon <linux.amoon@gmail.com>
> > ---
> > $ 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(+)
> >
> > diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
> > index 169ea283d4ee..a447cba4dd53 100644
> > --- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
> > +++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
> > @@ -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";
>
> 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.

>
> > +     };
> > +};
> > +
> >  &ir {
> >       status = "okay";
> >       pinctrl-0 = <&remote_input_ao_pins>;
> >
>
> Neil

-Anand

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCHv1 1/3] arm64: dts: meson-g12b-odroid-n2: Enable RTC controller node
  2020-07-15 16:02 ` [PATCHv1 1/3] arm64: dts: meson-g12b-odroid-n2: Enable RTC controller node Anand Moon
  2020-07-16  7:08   ` Neil Armstrong
@ 2020-07-16  8:08   ` Jerome Brunet
  2020-07-16  9:12     ` Anand Moon
  1 sibling, 1 reply; 17+ messages in thread
From: Jerome Brunet @ 2020-07-16  8:08 UTC (permalink / raw)
  To: Anand Moon, devicetree, linux-arm-kernel, linux-amlogic
  Cc: Mark Rutland, Kevin Hilman, Rob Herring, Martin Blumenstingl,
	Neil Armstrong


On Wed 15 Jul 2020 at 18:02, Anand Moon <linux.amoon@gmail.com> wrote:

> Enable RTC PCF8563 node on Odroid-N2 SBC, In order
> to support the RTC wakealarm feature for suspend and resume.
>
> Cc: Neil Armstrong <narmstrong@baylibre.com>
> Cc: Kevin Hilman <khilman@baylibre.com>
> Signed-off-by: Anand Moon <linux.amoon@gmail.com>
> ---
> $ 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(+)
>
> diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
> index 169ea283d4ee..a447cba4dd53 100644
> --- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
> +++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
> @@ -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";
> +	};

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

> +};
> +
>  &ir {
>  	status = "okay";
>  	pinctrl-0 = <&remote_input_ao_pins>;


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCHv1 0/3] Enable RTC on Odroid N2
  2020-07-16  7:05 ` [PATCHv1 0/3] Enable RTC on Odroid N2 Neil Armstrong
@ 2020-07-16  8:14   ` Anand Moon
  2020-07-16  8:20     ` Neil Armstrong
  0 siblings, 1 reply; 17+ messages in thread
From: Anand Moon @ 2020-07-16  8:14 UTC (permalink / raw)
  To: Neil Armstrong
  Cc: Mark Rutland, devicetree, Martin Blumenstingl, Kevin Hilman,
	Rob Herring, linux-amlogic, linux-arm-kernel, Jerome Brunet

Hi Neil,

Thanks for your review comments.

On Thu, 16 Jul 2020 at 12:35, Neil Armstrong <narmstrong@baylibre.com> wrote:
>
> 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

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCHv1 0/3] Enable RTC on Odroid N2
  2020-07-16  8:14   ` Anand Moon
@ 2020-07-16  8:20     ` Neil Armstrong
  2020-07-16  8:35       ` Neil Armstrong
  0 siblings, 1 reply; 17+ messages in thread
From: Neil Armstrong @ 2020-07-16  8:20 UTC (permalink / raw)
  To: Anand Moon
  Cc: Mark Rutland, devicetree, Martin Blumenstingl, Kevin Hilman,
	Rob Herring, linux-amlogic, linux-arm-kernel, Jerome Brunet

Hi,

On 16/07/2020 10:14, Anand Moon wrote:
> Hi Neil,
> 
> Thanks for your review comments.
> 
> On Thu, 16 Jul 2020 at 12:35, Neil Armstrong <narmstrong@baylibre.com> wrote:
>>
>> 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

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

> 
> real    0m0.002s
> user    0m0.001s
> sys     0m0.002s
> 
> -Anand
> 


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCHv1 0/3] Enable RTC on Odroid N2
  2020-07-16  8:20     ` Neil Armstrong
@ 2020-07-16  8:35       ` Neil Armstrong
  2020-07-16 15:42         ` Anand Moon
  2020-07-16 21:28         ` Kevin Hilman
  0 siblings, 2 replies; 17+ messages in thread
From: Neil Armstrong @ 2020-07-16  8:35 UTC (permalink / raw)
  To: Anand Moon
  Cc: Mark Rutland, devicetree, Martin Blumenstingl, Kevin Hilman,
	Rob Herring, linux-amlogic, linux-arm-kernel, Jerome Brunet

Hi,

On 16/07/2020 10:20, Neil Armstrong wrote:
> Hi,
> 
> On 16/07/2020 10:14, Anand Moon wrote:
>> Hi Neil,
>>
>> Thanks for your review comments.
>>
>> On Thu, 16 Jul 2020 at 12:35, Neil Armstrong <narmstrong@baylibre.com> wrote:
>>>
>>> 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
> 
> 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

> 
> Neil
> 
>>
>> real    0m0.002s
>> user    0m0.001s
>> sys     0m0.002s
>>
>> -Anand
>>
> 


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCHv1 1/3] arm64: dts: meson-g12b-odroid-n2: Enable RTC controller node
  2020-07-16  8:08   ` Jerome Brunet
@ 2020-07-16  9:12     ` Anand Moon
  0 siblings, 0 replies; 17+ messages in thread
From: Anand Moon @ 2020-07-16  9:12 UTC (permalink / raw)
  To: Jerome Brunet
  Cc: Mark Rutland, devicetree, Neil Armstrong, Martin Blumenstingl,
	Kevin Hilman, Rob Herring, linux-amlogic, linux-arm-kernel

Hi Jerome,

Thanks for your review comments.

On Thu, 16 Jul 2020 at 13:38, Jerome Brunet <jbrunet@baylibre.com> wrote:
>
>
> On Wed 15 Jul 2020 at 18:02, Anand Moon <linux.amoon@gmail.com> wrote:
>
> > Enable RTC PCF8563 node on Odroid-N2 SBC, In order
> > to support the RTC wakealarm feature for suspend and resume.
> >
> > Cc: Neil Armstrong <narmstrong@baylibre.com>
> > Cc: Kevin Hilman <khilman@baylibre.com>
> > Signed-off-by: Anand Moon <linux.amoon@gmail.com>
> > ---
> > $ 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(+)
> >
> > diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
> > index 169ea283d4ee..a447cba4dd53 100644
> > --- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
> > +++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
> > @@ -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";
> > +     };
>
> 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

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

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCHv1 0/3] Enable RTC on Odroid N2
  2020-07-16  8:35       ` Neil Armstrong
@ 2020-07-16 15:42         ` Anand Moon
  2020-07-16 21:28         ` Kevin Hilman
  1 sibling, 0 replies; 17+ messages in thread
From: Anand Moon @ 2020-07-16 15:42 UTC (permalink / raw)
  To: Neil Armstrong
  Cc: Mark Rutland, devicetree, Martin Blumenstingl, Kevin Hilman,
	Rob Herring, linux-amlogic, linux-arm-kernel, Jerome Brunet

hi Neil,

On Thu, 16 Jul 2020 at 14:05, Neil Armstrong <narmstrong@baylibre.com> wrote:
>
> Hi,
>
> On 16/07/2020 10:20, Neil Armstrong wrote:
> > Hi,
> >
> > On 16/07/2020 10:14, Anand Moon wrote:
> >> Hi Neil,
> >>
> >> Thanks for your review comments.
> >>
> >> On Thu, 16 Jul 2020 at 12:35, Neil Armstrong <narmstrong@baylibre.com> wrote:
> >>>
> >>> 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
> >
> > 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.
>
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

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCHv1 0/3] Enable RTC on Odroid N2
  2020-07-16  8:35       ` Neil Armstrong
  2020-07-16 15:42         ` Anand Moon
@ 2020-07-16 21:28         ` Kevin Hilman
  1 sibling, 0 replies; 17+ messages in thread
From: Kevin Hilman @ 2020-07-16 21:28 UTC (permalink / raw)
  To: Neil Armstrong, Anand Moon
  Cc: Mark Rutland, devicetree, Martin Blumenstingl, Rob Herring,
	linux-amlogic, linux-arm-kernel, Jerome Brunet

Neil Armstrong <narmstrong@baylibre.com> writes:

> Hi,
>
> On 16/07/2020 10:20, Neil Armstrong wrote:
>> Hi,
>> 
>> On 16/07/2020 10:14, Anand Moon wrote:
>>> Hi Neil,
>>>
>>> Thanks for your review comments.
>>>
>>> On Thu, 16 Jul 2020 at 12:35, Neil Armstrong <narmstrong@baylibre.com> wrote:
>>>>
>>>> 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
>> 
>> 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.

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

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2020-07-16 21:29 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-15 16:02 [PATCHv1 0/3] Enable RTC on Odroid N2 Anand Moon
2020-07-15 16:02 ` [PATCHv1 1/3] arm64: dts: meson-g12b-odroid-n2: Enable RTC controller node Anand Moon
2020-07-16  7:08   ` Neil Armstrong
2020-07-16  8:02     ` Anand Moon
2020-07-16  8:08   ` Jerome Brunet
2020-07-16  9:12     ` Anand Moon
2020-07-15 16:02 ` [PATCHv1 2/3] arm64: dts: meson-g12b-odroid-n2: Disable virtual wake RTC Anand Moon
2020-07-16  7:05   ` Neil Armstrong
2020-07-16  7:19     ` Anand Moon
2020-07-15 16:02 ` [PATCHv1 3/3] arm64: defconfig: Enable RTC devices for Amlogic boards Anand Moon
2020-07-16  7:08   ` Neil Armstrong
2020-07-16  7:05 ` [PATCHv1 0/3] Enable RTC on Odroid N2 Neil Armstrong
2020-07-16  8:14   ` Anand Moon
2020-07-16  8:20     ` Neil Armstrong
2020-07-16  8:35       ` Neil Armstrong
2020-07-16 15:42         ` Anand Moon
2020-07-16 21:28         ` Kevin Hilman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).