support for amlogic rtc
Subsystems (4)
Xianwei Zhao
maintainerv2 cover support for amlogic rtc
Add rtc driver and bindigns for the amlogic A113L2 and A113X2 SoCs
---
Changes in v2:
- Modify bindings clock name and perfect the example.
- Fix some bug in driver, and use dev_err_probe instead of dev_err in probe process.
- Use RTC API to handle calibration.
- Remove unused func and rename driver file name.
- Link to v1: https://lore.kernel.org/r/[email protected]
---
Yiting Deng (3):
dt-bindings: rtc: Add Amlogic A4 and A5 rtc
rtc: support for the Amlogic on-chip RTC
MAINTAINERS: Add an entry for Amlogic RTC driver
.../bindings/rtc/amlogic,amlogic-rtc.yaml | 66 +++ MAINTAINERS | 8 + drivers/rtc/Kconfig | 12 + drivers/rtc/Makefile | 1 + drivers/rtc/rtc-amlogic-a4.c | 481 +++++++++++++++++++++ 5 files changed, 568 insertions(+)
---
base-commit: 3047c9a740816d5a930c8c741c3932a3544267f2
change-id: 20240823-rtc-127cd8192a13
Best regards,
Signature · 1 line
Xianwei Zhao <[email protected]>
Xianwei Zhao
maintainerPATCH v2 1/3 dt-bindings: rtc: Add Amlogic A4 and A5 rtc
From: Yiting Deng <[email protected]>
Add documentation describing the Amlogic A4(A113L2) and A5(A113X2) rtc controller.
--- .../bindings/rtc/amlogic,amlogic-rtc.yaml | 66 ++++++++++++++++++++++ 1 file changed, 66 insertions(+)
Documentation/devicetree/bindings/rtc/amlogic,amlogic-rtc.yaml new file +66 -0
@@ -0,0 +1,66 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# Copyright (C) 2024 Amlogic, Inc. All rights reserved +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/rtc/amlogic,amlogic-rtc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Amlogic Real Time Clock controller include a4, a5 + +maintainers: + - Yiting Deng <[email protected]> + - Xianwei Zhao <[email protected]> + +description: + The Amlogic new chips used RTC module. + +allOf: + - $ref: rtc.yaml# + +properties: + compatible: + enum: + - amlogic,a4-rtc + - amlogic,a5-rtc + + reg: + maxItems: 1 + + clocks: + items: + - description: RTC clock source, available 24M or 32K crystal + oscillator source. when using 24M, need to divide 24M into 32K. + - description: RTC module accesses the clock of the apb bus. + + clock-names: + items: + - const: osc + - const: sys + + interrupts: + maxItems: 1 + +required: + - compatible + - reg + - interrupts + - clocks + - clock-names + +additionalProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/arm-gic.h> + apb { + #address-cells = <2>; + #size-cells = <2>; + + rtc@8e600 { + compatible = "amlogic,a4-rtc"; + reg = <0x0 0x8e600 0x0 0x38>; + interrupts = <GIC_SPI 131 IRQ_TYPE_EDGE_RISING>; + clocks = <&xtal_32k>, <&clkc_periphs 1>; + clock-names = "osc", "sys"; + }; + };
Signature · 1 line
2.37.1
Re: [PATCH v2 1/3] dt-bindings: rtc: Add Amlogic A4 and A5 rtc
Quoted 4 lines · On 03/09/2024 09:00, Xianwei Zhao via B4 Relay wrote:
From: Yiting Deng <[email protected]>
Add documentation describing the Amlogic A4(A113L2) and A5(A113X2) rtc controller.
RTC. And no "controller".
Documentation/devicetree/bindings/rtc/amlogic,amlogic-rtc.yaml
Quoted 12 lines
Signed-off-by Yiting Deng <[email protected]>Signed-off-by Xianwei Zhao <[email protected]>--- .../bindings/rtc/amlogic,amlogic-rtc.yaml | 66 ++++++++++++++++++++++ 1 file changed, 66 insertions(+)Documentation/devicetree/bindings/rtc/amlogic,amlogic-rtc.yaml new file +0
-0
That's odd filename. Use compatible as the filename.
Documentation/devicetree/bindings/rtc/amlogic,amlogic-rtc.yaml line 8
Quoted 9 lines
Documentation/devicetree/bindings/rtc/amlogic,amlogic-rtc.yaml new file +8
-0@@ -0,0 +1,66 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# Copyright (C) 2024 Amlogic, Inc. All rights reserved +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/rtc/amlogic,amlogic-rtc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Amlogic Real Time Clock controller include a4, a5
Sorry, that's unparseable. Either this is clock controller or RTC. What does it mean "include a4"?
Documentation/devicetree/bindings/rtc/amlogic,amlogic-rtc.yaml line 15
Quoted 7 lines
Documentation/devicetree/bindings/rtc/amlogic,amlogic-rtc.yaml new file +7
-0+ +maintainers: + - Yiting Deng <[email protected]> + - Xianwei Zhao <[email protected]> + +description: + The Amlogic new chips used RTC module.
This tells me nothing. Please say something useful or drop this.
Best regards,
Krzysztof
Xianwei Zhao
maintainerRe: [PATCH v2 1/3] dt-bindings: rtc: Add Amlogic A4 and A5 rtc
Hi Krzysztof,
Thanks for your reply.
Quoted 10 lines · Krzysztof Kozlowski
[ EXTERNAL EMAIL ]
Quoted 4 lines · On 03/09/2024 09:00, Xianwei Zhao via B4 Relay wrote:
From: Yiting Deng <[email protected]>
Add documentation describing the Amlogic A4(A113L2) and A5(A113X2) rtc controller.
RTC. And no "controller".
Will do, describe it as "Add documentation describing the Amlogic A4(A113L2) and A5(A113X2) RTC."
Quoted 7 lines
Quoted 7 lines
Signed-off-by Yiting Deng <[email protected]>Signed-off-by Xianwei Zhao <[email protected]>--- .../bindings/rtc/amlogic,amlogic-rtc.yaml | 66 ++++++++++++++++++++++ 1 file changed, 66 insertions(+)
Quoted 8 lines
Documentation/devicetree/bindings/rtc/amlogic,amlogic-rtc.yaml
Quoted 5 lines
Documentation/devicetree/bindings/rtc/amlogic,amlogic-rtc.yaml new file +0
-0That's odd filename. Use compatible as the filename.
Will do, rename "amlogic,a4-rtc.yaml".
Quoted 4 lines
Quoted 4 lines
Documentation/devicetree/bindings/rtc/amlogic,amlogic-rtc.yaml new file +3
-0@@ -0,0 +1,66 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# Copyright (C) 2024 Amlogic, Inc. All rights reserved +%YAML 1.2
Quoted 9 lines
Documentation/devicetree/bindings/rtc/amlogic,amlogic-rtc.yaml line 8
Quoted 5 lines
Documentation/devicetree/bindings/rtc/amlogic,amlogic-rtc.yaml new file +5
-0+--- +$id: http://devicetree.org/schemas/rtc/amlogic,amlogic-rtc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Amlogic Real Time Clock controller include a4, a5Sorry, that's unparseable. Either this is clock controller or RTC. What does it mean "include a4"?
Will describe it to "title: Amlogic A4 and A5 RTC".
Quoted 11 lines
Documentation/devicetree/bindings/rtc/amlogic,amlogic-rtc.yaml line 15
Quoted 8 lines
Documentation/devicetree/bindings/rtc/amlogic,amlogic-rtc.yaml new file +7
-0+ +maintainers: + - Yiting Deng <[email protected]> + - Xianwei Zhao <[email protected]> + +description: + The Amlogic new chips used RTC module.This tells me nothing. Please say something useful or drop this.
Will drop description.
Quoted 3 lines
Best regards,
Krzysztof
Xianwei Zhao
maintainerPATCH v2 2/3 rtc: support for the Amlogic on-chip RTC
In reply to Xianwei ZhaoFrom: Yiting Deng <[email protected]>
Support for the on-chip RTC found in some of Amlogic's SoCs such as the A4(A113L2) and A5(A113X2). The RTC hardware includes a timing function and an alarm function.
--- drivers/rtc/Kconfig | 12 ++ drivers/rtc/Makefile | 1 + drivers/rtc/rtc-amlogic-a4.c | 481 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 494 insertions(+)
drivers/rtc/Kconfig +12 -0
@@ -2043,4 +2043,16 @@ config RTC_DRV_SSD202D This driver can also be built as a module, if so, the module will be called "rtc-ssd20xd". +config RTC_DRV_AMLOGIC_A4 + tristate "Amlogic RTC" + depends on ARCH_MESON || COMPILE_TEST + select REGMAP_MMIO + default y + help + If you say yes here you get support for the RTC block on the + Amlogic A113L2(A4) and A113X2(A5) SoCs. + + This driver can also be built as a module. If so, the module + will be called "rtc-amlogic-a4". + endif # RTC_CLASS
drivers/rtc/Makefile +1 -0
@@ -26,6 +26,7 @@ obj-$(CONFIG_RTC_DRV_ABB5ZES3) += rtc-ab-b5ze-s3.o obj-$(CONFIG_RTC_DRV_ABEOZ9) += rtc-ab-eoz9.o obj-$(CONFIG_RTC_DRV_ABX80X) += rtc-abx80x.o obj-$(CONFIG_RTC_DRV_AC100) += rtc-ac100.o +obj-$(CONFIG_RTC_DRV_AMLOGIC_A4) += rtc-amlogic-a4.o obj-$(CONFIG_RTC_DRV_ARMADA38X) += rtc-armada38x.o obj-$(CONFIG_RTC_DRV_AS3722) += rtc-as3722.o obj-$(CONFIG_RTC_DRV_ASM9260) += rtc-asm9260.o
drivers/rtc/rtc-amlogic-a4.c new file +481 -0
481 lines not on this page · raw message
Signature · 1 line
2.37.1
Re: [PATCH v2 2/3] rtc: support for the Amlogic on-chip RTC
Quoted 2 lines · On 03/09/2024 09:00, Xianwei Zhao via B4 Relay wrote:
From: Yiting Deng <[email protected]>
...
drivers/rtc/rtc-amlogic-a4.c line 352
Quoted 4 lines
drivers/rtc/rtc-amlogic-a4.c new file +4
-0+ rtc->map =devm_regmap_init_mmio (&pdev->dev, base, &aml_rtc_regmap_config); +if (IS_ERR (rtc->map)) { +dev_err_probe (&pdev->dev,PTR_ERR (rtc->map),"regmap init failed\n" ); +return PTR_ERR (rtc->map);
Nothing improved. Read the comment. Use git grep to see how this is done if the comment is somehow unclear.
<form letter>
This is a friendly reminder during the review process.
It seems my or other reviewer's previous comments were not fully addressed. Maybe the feedback got lost between the quotes, maybe you just forgot to apply it. Please go back to the previous discussion and either implement all requested changes or keep discussing them.
Thank you.
</form letter>
Best regards,
Krzysztof
Xianwei Zhao
maintainerRe: [PATCH v2 2/3] rtc: support for the Amlogic on-chip RTC
Hi Krzysztof,
Thanks for your reply.
Quoted 8 lines · Krzysztof Kozlowski
[ EXTERNAL EMAIL ]
Quoted 2 lines · On 03/09/2024 09:00, Xianwei Zhao via B4 Relay wrote:
From: Yiting Deng <[email protected]>
...
Quoted 8 lines
drivers/rtc/rtc-amlogic-a4.c line 352
Quoted 4 lines
drivers/rtc/rtc-amlogic-a4.c new file +4
-0+ rtc->map =devm_regmap_init_mmio (&pdev->dev, base, &aml_rtc_regmap_config); +if (IS_ERR (rtc->map)) { +dev_err_probe (&pdev->dev,PTR_ERR (rtc->map),"regmap init failed\n" ); +return PTR_ERR (rtc->map);Nothing improved. Read the comment. Use git grep to see how this is done if the comment is somehow unclear.
Got it, Merge two statements into one.
"return dev_err_probe();"
Will fix it.
Quoted 8 lines
<form letter>
This is a friendly reminder during the review process.It seems my or other reviewer's previous comments were not fully addressed. Maybe the feedback got lost between the quotes, maybe you just forgot to apply it. Please go back to the previous discussion and either implement all requested changes or keep discussing them.
"So the third driver? What is wrong with existing ones? And why this one
is named so differently?"
Are you saying these part were not fully addressed? If so, let me answer it here.
Yes, this is the third driver.The RTC hardware of A4 SoC is different from the previous one, so need add new RTC driver to support it.
A4 RTC hardware includes a timing function and an alarm function.
But the existing has only timing function, alarm function is using the system clock to implement a virtual alarm.
The driver file name modfiy to rtc-amlogic-a4.c suggested by Alexandre Belloni.
Quoted 6 lines
Thank you.
</form letter>Best regards,
Krzysztof
Xianwei Zhao
maintainerPATCH v2 3/3 MAINTAINERS: Add an entry for Amlogic RTC driver
In reply to Xianwei ZhaoFrom: Yiting Deng <[email protected]>
Add Amlogic RTC entry to MAINTAINERS to clarify the maintainers
--- MAINTAINERS | 8 ++++++++ 1 file changed, 8 insertions(+)
MAINTAINERS +8 -0
@@ -2481,6 +2481,14 @@ F: drivers/irqchip/irq-mvebu-* F: drivers/pinctrl/mvebu/ F: drivers/rtc/rtc-armada38x.c +AMLOGIC RTC DRIVER +M: Yiting Deng <[email protected]> +M: Xianwei Zhao <[email protected]> +L: [email protected] +S: Maintained +F: Documentation/devicetree/bindings/rtc/amlogic,amlogic-rtc.yaml +F: drivers/rtc/rtc-amlogic-a4.c + ARM/Mediatek RTC DRIVER M: Eddie Huang <[email protected]> M: Sean Wang <[email protected]>
Signature · 1 line
2.37.1
Re: [PATCH v2 3/3] MAINTAINERS: Add an entry for Amlogic RTC driver
Quoted 15 lines · On 03/09/2024 09:00, Xianwei Zhao via B4 Relay wrote:
From: Yiting Deng <[email protected]>
Add Amlogic RTC entry to
MAINTAINERSto clarify the maintainersSigned-off-by Yiting Deng <[email protected]>Signed-off-by Xianwei Zhao <[email protected]>--- MAINTAINERS | 8 ++++++++ 1 file changed, 8 insertions(+)MAINTAINERS +0
-0
MAINTAINERS F: drivers/irqchip/irq-mvebu-* · line 2484
Quoted 4 lines
MAINTAINERS +1
-0@@ -2481,6 +2481,14 @@ F: drivers/irqchip/irq-mvebu-* F: drivers/pinctrl/mvebu/ F: drivers/rtc/rtc-armada38x.c +AMLOGIC RTC DRIVER
Nope. Read the note in the file about order.
Best regards,
Krzysztof
Xianwei Zhao
maintainerRe: [PATCH v2 3/3] MAINTAINERS: Add an entry for Amlogic RTC driver
Hi Krzysztof,
Thanks for your reply.
Quoted 21 lines · Krzysztof Kozlowski
[ EXTERNAL EMAIL ]
Quoted 18 lines · On 03/09/2024 09:00, Xianwei Zhao via B4 Relay wrote:
From: Yiting Deng <[email protected]>
Add Amlogic RTC entry to
MAINTAINERSto clarify the maintainersSigned-off-by Yiting Deng <[email protected]>Signed-off-by Xianwei Zhao <[email protected]>--- MAINTAINERS | 8 ++++++++ 1 file changed, 8 insertions(+)MAINTAINERS +0
-0@@ -2481,6 +2481,14 @@ F: drivers/irqchip/irq-mvebu-* F: drivers/pinctrl/mvebu/ F: drivers/rtc/rtc-armada38x.c
Quoted 4 lines
MAINTAINERS F: drivers/irqchip/irq-mvebu-* · line 2484
Quoted 1 line
MAINTAINERS +1
-0+AMLOGIC RTC DRIVERNope. Read the note in the file about order.
Will put it in the right place alphabetically.
Quoted 3 lines
Best regards,
Krzysztof