linux-amlogic.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] Meson8b: add support for the RTC on EC-100 and Odroid-C1
@ 2019-04-13 16:34 Martin Blumenstingl
  2019-04-13 16:34 ` [PATCH 1/3] ARM: dts: meson: add support for the RTC Martin Blumenstingl
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Martin Blumenstingl @ 2019-04-13 16:34 UTC (permalink / raw)
  To: linux-amlogic, khilman
  Cc: Martin Blumenstingl, jianxin.pan, linux-kernel, linux-arm-kernel,
	ccaione

This adds support for the RTC on the Meson8b EC-100 and Odroid-C1
boards. Example kernel log snippet while booting my EC-100:
  [    5.713750] meson-rtc c8100740.rtc: setting system clock to 2019-04-13T16:21:48 UTC (1555172508)

I am only 99% sure about the naming of the clock in patch 2 and 3.
The public S805 datasheet from Hardkernel shows (on page 24 for example)
that clk81 can use "XTAL/32khz" as clock input. That "XTAL/32khz" clock
is described as a mux between 24MHz (our main XTAL) and 32kHz ("that
other XTAL").
I believe that this other 32kHz XTAL is NOT the RTC32K crystal because:
- schematics of the EC-100 and Odroid-C1 clearly show that the SoC input
  for the RTC32K clock is labeled RTC32K_XI / RTC32K_XO
- GPIOAO_6 has a CLK_32KIN function (shows in EC-100 and Odroid-C1
  schematics as well as the public S805 datasheet)
- Always On domain PWR_CNTL0[11:10] (public S805 datasheet page 19)
  describes it as "Alternate 32khz input clock select from GPIO pad"

Thus I believe that the naming of the RTC32K clock is correct, but I
wanted to point out that I'm only 99% (instead of 100%) sure.
Jianxin, please let me know if you disagree with my findings.


Martin Blumenstingl (3):
  ARM: dts: meson: add support for the RTC
  ARM: dts: meson8b: ec100: enable the RTC
  ARM: dts: meson8b: odroid-c1: prepare support for the RTC

 arch/arm/boot/dts/meson.dtsi           |  9 +++++++++
 arch/arm/boot/dts/meson8.dtsi          |  5 +++++
 arch/arm/boot/dts/meson8b-ec100.dts    | 14 ++++++++++++++
 arch/arm/boot/dts/meson8b-odroidc1.dts | 14 ++++++++++++++
 arch/arm/boot/dts/meson8b.dtsi         |  5 +++++
 5 files changed, 47 insertions(+)

-- 
2.21.0


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

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

* [PATCH 1/3] ARM: dts: meson: add support for the RTC
  2019-04-13 16:34 [PATCH 0/3] Meson8b: add support for the RTC on EC-100 and Odroid-C1 Martin Blumenstingl
@ 2019-04-13 16:34 ` Martin Blumenstingl
  2019-04-13 16:34 ` [PATCH 2/3] ARM: dts: meson8b: ec100: enable " Martin Blumenstingl
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Martin Blumenstingl @ 2019-04-13 16:34 UTC (permalink / raw)
  To: linux-amlogic, khilman
  Cc: Martin Blumenstingl, jianxin.pan, linux-kernel, linux-arm-kernel,
	ccaione

The 32-bit Meson SoCs have an RTC block in the AO (always on) area. The
RTC requires an external 32.768 kHz oscillator to work properly. Whether
or not this crystal exists depends on the board, so it has to be added
for each board.dts (instead of adding it somewhere in a generic .dtsi).

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
---
 arch/arm/boot/dts/meson.dtsi   | 9 +++++++++
 arch/arm/boot/dts/meson8.dtsi  | 5 +++++
 arch/arm/boot/dts/meson8b.dtsi | 5 +++++
 3 files changed, 19 insertions(+)

diff --git a/arch/arm/boot/dts/meson.dtsi b/arch/arm/boot/dts/meson.dtsi
index 6f54a8897574..8841783aceec 100644
--- a/arch/arm/boot/dts/meson.dtsi
+++ b/arch/arm/boot/dts/meson.dtsi
@@ -252,6 +252,15 @@
 				#size-cells = <0>;
 				status = "disabled";
 			};
+
+			rtc: rtc@740 {
+				compatible = "amlogic,meson6-rtc";
+				reg = <0x740 0x14>;
+				interrupts = <GIC_SPI 72 IRQ_TYPE_EDGE_RISING>;
+				#address-cells = <1>;
+				#size-cells = <1>;
+				status = "disabled";
+			};
 		};
 
 		usb0: usb@c9040000 {
diff --git a/arch/arm/boot/dts/meson8.dtsi b/arch/arm/boot/dts/meson8.dtsi
index d2ec4af82cc5..7ef442462ea4 100644
--- a/arch/arm/boot/dts/meson8.dtsi
+++ b/arch/arm/boot/dts/meson8.dtsi
@@ -541,6 +541,11 @@
 	compatible = "amlogic,meson8-pwm", "amlogic,meson8b-pwm";
 };
 
+&rtc {
+	compatible = "amlogic,meson8-rtc";
+	resets = <&reset RESET_RTC>;
+};
+
 &saradc {
 	compatible = "amlogic,meson8-saradc", "amlogic,meson-saradc";
 	clocks = <&clkc CLKID_XTAL>,
diff --git a/arch/arm/boot/dts/meson8b.dtsi b/arch/arm/boot/dts/meson8b.dtsi
index df42e48f1cc1..800cd65fc50a 100644
--- a/arch/arm/boot/dts/meson8b.dtsi
+++ b/arch/arm/boot/dts/meson8b.dtsi
@@ -510,6 +510,11 @@
 	compatible = "amlogic,meson8b-pwm";
 };
 
+&rtc {
+	compatible = "amlogic,meson8b-rtc";
+	resets = <&reset RESET_RTC>;
+};
+
 &saradc {
 	compatible = "amlogic,meson8b-saradc", "amlogic,meson-saradc";
 	clocks = <&clkc CLKID_XTAL>,
-- 
2.21.0


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

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

* [PATCH 2/3] ARM: dts: meson8b: ec100: enable the RTC
  2019-04-13 16:34 [PATCH 0/3] Meson8b: add support for the RTC on EC-100 and Odroid-C1 Martin Blumenstingl
  2019-04-13 16:34 ` [PATCH 1/3] ARM: dts: meson: add support for the RTC Martin Blumenstingl
@ 2019-04-13 16:34 ` Martin Blumenstingl
  2019-04-13 16:34 ` [PATCH 3/3] ARM: dts: meson8b: odroid-c1: prepare support for " Martin Blumenstingl
  2019-04-16 19:01 ` [PATCH 0/3] Meson8b: add support for the RTC on EC-100 and Odroid-C1 Kevin Hilman
  3 siblings, 0 replies; 6+ messages in thread
From: Martin Blumenstingl @ 2019-04-13 16:34 UTC (permalink / raw)
  To: linux-amlogic, khilman
  Cc: Martin Blumenstingl, jianxin.pan, linux-kernel, linux-arm-kernel,
	ccaione

The RTC is always enabled on this board since the battery is already
connected in the factory.
According to the schematics the VCC_RTC regulator (which is either
powered by the internal 3.3V or a battery) is connected to the 0.9V
RTC_VDD input of the SoCs.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
---
 arch/arm/boot/dts/meson8b-ec100.dts | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/arch/arm/boot/dts/meson8b-ec100.dts b/arch/arm/boot/dts/meson8b-ec100.dts
index 3ca9638fad09..9bf4249cb60d 100644
--- a/arch/arm/boot/dts/meson8b-ec100.dts
+++ b/arch/arm/boot/dts/meson8b-ec100.dts
@@ -88,6 +88,14 @@
 		};
 	};
 
+	rtc32k_xtal: rtc32k-xtal-clk {
+		/* X2 in the schematics */
+		compatible = "fixed-clock";
+		clock-frequency = <32768>;
+		clock-output-names = "RTC32K";
+		#clock-cells = <0>;
+	};
+
 	usb_vbus: regulator-usb-vbus {
 		/*
 		 * Silergy SY6288CCAC-GP 2A Power Distribution Switch.
@@ -347,6 +355,12 @@
 	clock-names = "clkin0";
 };
 
+&rtc {
+	status = "okay";
+	clocks = <&rtc32k_xtal>;
+	vdd-supply = <&vcc_rtc>;
+};
+
 /* exposed through the pin headers labeled "URDUG1" on the top of the PCB */
 &uart_AO {
 	status = "okay";
-- 
2.21.0


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

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

* [PATCH 3/3] ARM: dts: meson8b: odroid-c1: prepare support for the RTC
  2019-04-13 16:34 [PATCH 0/3] Meson8b: add support for the RTC on EC-100 and Odroid-C1 Martin Blumenstingl
  2019-04-13 16:34 ` [PATCH 1/3] ARM: dts: meson: add support for the RTC Martin Blumenstingl
  2019-04-13 16:34 ` [PATCH 2/3] ARM: dts: meson8b: ec100: enable " Martin Blumenstingl
@ 2019-04-13 16:34 ` Martin Blumenstingl
  2019-04-16 19:00   ` Kevin Hilman
  2019-04-16 19:01 ` [PATCH 0/3] Meson8b: add support for the RTC on EC-100 and Odroid-C1 Kevin Hilman
  3 siblings, 1 reply; 6+ messages in thread
From: Martin Blumenstingl @ 2019-04-13 16:34 UTC (permalink / raw)
  To: linux-amlogic, khilman
  Cc: Martin Blumenstingl, jianxin.pan, linux-kernel, linux-arm-kernel,
	ccaione

The Odroid-C1 has the 32.768 kHz oscillator (X3 in the schematics) which
is required for the RTC. A battery can be connected separately (to the
BT1 header) - then the "rtc" node can be enabled manually. By default
the RTC is disabled because the boards typically come without the RTC
battery.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
---
 arch/arm/boot/dts/meson8b-odroidc1.dts | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/arch/arm/boot/dts/meson8b-odroidc1.dts b/arch/arm/boot/dts/meson8b-odroidc1.dts
index 0157646e3a89..f3ad9397f670 100644
--- a/arch/arm/boot/dts/meson8b-odroidc1.dts
+++ b/arch/arm/boot/dts/meson8b-odroidc1.dts
@@ -124,6 +124,14 @@
 		io-channels = <&saradc 8>;
 	};
 
+	rtc32k_xtal: rtc32k-xtal-clk {
+		/* X3 in the schematics */
+		compatible = "fixed-clock";
+		clock-frequency = <32768>;
+		clock-output-names = "RTC32K";
+		#clock-cells = <0>;
+	};
+
 	vcc_1v8: regulator-vcc-1v8 {
 		/*
 		 * RICHTEK RT9179 configured for a fixed output voltage of
@@ -345,6 +353,12 @@
 	clock-names = "clkin0";
 };
 
+&rtc {
+	/* needs to be enabled manually when a battery is connected */
+	clocks = <&rtc32k_xtal>;
+	vdd-supply = <&vdd_rtc>;
+};
+
 &uart_AO {
 	status = "okay";
 	pinctrl-0 = <&uart_ao_a_pins>;
-- 
2.21.0


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

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

* Re: [PATCH 3/3] ARM: dts: meson8b: odroid-c1: prepare support for the RTC
  2019-04-13 16:34 ` [PATCH 3/3] ARM: dts: meson8b: odroid-c1: prepare support for " Martin Blumenstingl
@ 2019-04-16 19:00   ` Kevin Hilman
  0 siblings, 0 replies; 6+ messages in thread
From: Kevin Hilman @ 2019-04-16 19:00 UTC (permalink / raw)
  To: Martin Blumenstingl, linux-amlogic
  Cc: Martin Blumenstingl, jianxin.pan, linux-kernel, linux-arm-kernel,
	ccaione

Martin Blumenstingl <martin.blumenstingl@googlemail.com> writes:

> The Odroid-C1 has the 32.768 kHz oscillator (X3 in the schematics) which
> is required for the RTC. A battery can be connected separately (to the
> BT1 header) - then the "rtc" node can be enabled manually. By default
> the RTC is disabled because the boards typically come without the RTC
> battery.
>
> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> ---
>  arch/arm/boot/dts/meson8b-odroidc1.dts | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
>
> diff --git a/arch/arm/boot/dts/meson8b-odroidc1.dts b/arch/arm/boot/dts/meson8b-odroidc1.dts
> index 0157646e3a89..f3ad9397f670 100644
> --- a/arch/arm/boot/dts/meson8b-odroidc1.dts
> +++ b/arch/arm/boot/dts/meson8b-odroidc1.dts
> @@ -124,6 +124,14 @@
>  		io-channels = <&saradc 8>;
>  	};
>  
> +	rtc32k_xtal: rtc32k-xtal-clk {
> +		/* X3 in the schematics */

Always nice to see the names from the schematics.

Thanks!

Kevin

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

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

* Re: [PATCH 0/3] Meson8b: add support for the RTC on EC-100 and Odroid-C1
  2019-04-13 16:34 [PATCH 0/3] Meson8b: add support for the RTC on EC-100 and Odroid-C1 Martin Blumenstingl
                   ` (2 preceding siblings ...)
  2019-04-13 16:34 ` [PATCH 3/3] ARM: dts: meson8b: odroid-c1: prepare support for " Martin Blumenstingl
@ 2019-04-16 19:01 ` Kevin Hilman
  3 siblings, 0 replies; 6+ messages in thread
From: Kevin Hilman @ 2019-04-16 19:01 UTC (permalink / raw)
  To: Martin Blumenstingl, linux-amlogic
  Cc: Martin Blumenstingl, jianxin.pan, linux-kernel, linux-arm-kernel,
	ccaione

Martin Blumenstingl <martin.blumenstingl@googlemail.com> writes:

> This adds support for the RTC on the Meson8b EC-100 and Odroid-C1
> boards. Example kernel log snippet while booting my EC-100:
>   [    5.713750] meson-rtc c8100740.rtc: setting system clock to 2019-04-13T16:21:48 UTC (1555172508)
>
> I am only 99% sure about the naming of the clock in patch 2 and 3.
> The public S805 datasheet from Hardkernel shows (on page 24 for example)
> that clk81 can use "XTAL/32khz" as clock input. That "XTAL/32khz" clock
> is described as a mux between 24MHz (our main XTAL) and 32kHz ("that
> other XTAL").
> I believe that this other 32kHz XTAL is NOT the RTC32K crystal because:
> - schematics of the EC-100 and Odroid-C1 clearly show that the SoC input
>   for the RTC32K clock is labeled RTC32K_XI / RTC32K_XO
> - GPIOAO_6 has a CLK_32KIN function (shows in EC-100 and Odroid-C1
>   schematics as well as the public S805 datasheet)
> - Always On domain PWR_CNTL0[11:10] (public S805 datasheet page 19)
>   describes it as "Alternate 32khz input clock select from GPIO pad"
>
> Thus I believe that the naming of the RTC32K clock is correct, but I
> wanted to point out that I'm only 99% (instead of 100%) sure.
> Jianxin, please let me know if you disagree with my findings.

99% confidence is higher than we normally have, so that's fine by me. :)
And, we can fix if we get any updated info from Jianxin.

Thanks for the detailed description.

Queuing for v5.2,

Kevin

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

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

end of thread, other threads:[~2019-04-16 19:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-13 16:34 [PATCH 0/3] Meson8b: add support for the RTC on EC-100 and Odroid-C1 Martin Blumenstingl
2019-04-13 16:34 ` [PATCH 1/3] ARM: dts: meson: add support for the RTC Martin Blumenstingl
2019-04-13 16:34 ` [PATCH 2/3] ARM: dts: meson8b: ec100: enable " Martin Blumenstingl
2019-04-13 16:34 ` [PATCH 3/3] ARM: dts: meson8b: odroid-c1: prepare support for " Martin Blumenstingl
2019-04-16 19:00   ` Kevin Hilman
2019-04-16 19:01 ` [PATCH 0/3] Meson8b: add support for the RTC on EC-100 and Odroid-C1 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).