public inbox for linux-rtc@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/3] RTC: Add Loongson-2K0300 support
@ 2026-01-17  2:26 Binbin Zhou
  2026-01-17  2:26 ` [PATCH v3 1/3] dt-bindings: rtc: loongson: Correct Loongson-1C interrupts property Binbin Zhou
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Binbin Zhou @ 2026-01-17  2:26 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Alexandre Belloni, linux-rtc
  Cc: Xiaochuang Mao, Huacai Chen, Xuerui Wang, loongarch, devicetree,
	linux-mips, Keguang Zhang, Binbin Zhou

Hi all:

This patch set introduces the Loongson-2K0300 RTC, which has a similar
hardware design to the Loongson-1B, but without the alarm feature.

Thanks.
Binbin

==========
V3:
- Add Reviewed-by tag from Huacai, thanks.

Patch (1/3):
 - Update commit title: dt-binding -> dt-bindings;
 - Update the commit message to describe the binding ABI breaking.
 - Drop `not` and  flip the 'then' and 'else' schemas around.

Patch (2/3):
 - Update commit title: dt-binding -> dt-bindings.

Link to V2:
https://lore.kernel.org/all/cover.1767663073.git.zhoubinbin@loongson.cn/

V2:
Patch (1/3):
 - New patch, correct Loongson-1C `interrupts` property;

Patch (2/3):
 - Drop Loongson-1C changes;

Patch (3/3):
 - Rename LS1C_RTC_CTRL_WORKAROUND to LOONGSON_RTC_CTRL_WORKAROUND for
   consistency.

Link to V1:
https://lore.kernel.org/all/cover.1766471839.git.zhoubinbin@loongson.cn/

Binbin Zhou (3):
  dt-bindings: rtc: loongson: Correct Loongson-1C interrupts property
  dt-bindings: rtc: loongson: Document Loongson-2K0300 compatible
  rtc: loongson: Add Loongson-2K0300 support

 .../devicetree/bindings/rtc/loongson,rtc.yaml | 13 ++++
 drivers/rtc/rtc-loongson.c                    | 71 ++++++++++++-------
 2 files changed, 60 insertions(+), 24 deletions(-)


base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
-- 
2.47.3


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

* [PATCH v3 1/3] dt-bindings: rtc: loongson: Correct Loongson-1C interrupts property
  2026-01-17  2:26 [PATCH v3 0/3] RTC: Add Loongson-2K0300 support Binbin Zhou
@ 2026-01-17  2:26 ` Binbin Zhou
  2026-01-19 18:24   ` Conor Dooley
  2026-01-17  2:26 ` [PATCH v3 2/3] dt-bindings: rtc: loongson: Document Loongson-2K0300 compatible Binbin Zhou
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 13+ messages in thread
From: Binbin Zhou @ 2026-01-17  2:26 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Alexandre Belloni, linux-rtc
  Cc: Xiaochuang Mao, Huacai Chen, Xuerui Wang, loongarch, devicetree,
	linux-mips, Keguang Zhang, Binbin Zhou

The `interrupts` property indicates an RTC alarm interrupt, which is
required for RTCs that support the alarm feature, which is not supported
by the Loongson-1C RTC. We exclude it for a more accurate description.

Changing the `allowed` property is ABI-breaking behavior, but
throughout the existing Loongson DTS{i}, the description of the RTC
nodes conforms to the modified bingding rules.

Thus, the existing Loongson DTS{i} will not be affected.

Fixes: 487ef32caebe ("dt-bindings: rtc: Split loongson,ls2x-rtc into SoC-based compatibles")
Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 .../devicetree/bindings/rtc/loongson,rtc.yaml         | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/Documentation/devicetree/bindings/rtc/loongson,rtc.yaml b/Documentation/devicetree/bindings/rtc/loongson,rtc.yaml
index f89c1f660aee..fac90a18153e 100644
--- a/Documentation/devicetree/bindings/rtc/loongson,rtc.yaml
+++ b/Documentation/devicetree/bindings/rtc/loongson,rtc.yaml
@@ -42,6 +42,17 @@ required:
 
 unevaluatedProperties: false
 
+if:
+  properties:
+    compatible:
+      contains:
+        enum:
+          - loongson,ls1c-rtc
+
+then:
+  properties:
+    interrupts: false
+
 examples:
   - |
     #include <dt-bindings/interrupt-controller/irq.h>
-- 
2.47.3


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

* [PATCH v3 2/3] dt-bindings: rtc: loongson: Document Loongson-2K0300 compatible
  2026-01-17  2:26 [PATCH v3 0/3] RTC: Add Loongson-2K0300 support Binbin Zhou
  2026-01-17  2:26 ` [PATCH v3 1/3] dt-bindings: rtc: loongson: Correct Loongson-1C interrupts property Binbin Zhou
@ 2026-01-17  2:26 ` Binbin Zhou
  2026-01-19 18:21   ` Conor Dooley
  2026-01-17  2:26 ` [PATCH v3 3/3] rtc: loongson: Add Loongson-2K0300 support Binbin Zhou
  2026-01-30 23:16 ` [PATCH v3 0/3] RTC: " Alexandre Belloni
  3 siblings, 1 reply; 13+ messages in thread
From: Binbin Zhou @ 2026-01-17  2:26 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Alexandre Belloni, linux-rtc
  Cc: Xiaochuang Mao, Huacai Chen, Xuerui Wang, loongarch, devicetree,
	linux-mips, Keguang Zhang, Binbin Zhou

Add "loongson,ls2k0300-rtc" dedicated compatible to represent the RTC
interface of the Loongson-2K0300 chip.

Its hardware design is similar to that of the Loongson-1B, but it does
not support the alarm feature.

Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 Documentation/devicetree/bindings/rtc/loongson,rtc.yaml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/rtc/loongson,rtc.yaml b/Documentation/devicetree/bindings/rtc/loongson,rtc.yaml
index fac90a18153e..aac91c79ffdb 100644
--- a/Documentation/devicetree/bindings/rtc/loongson,rtc.yaml
+++ b/Documentation/devicetree/bindings/rtc/loongson,rtc.yaml
@@ -23,6 +23,7 @@ properties:
           - loongson,ls1b-rtc
           - loongson,ls1c-rtc
           - loongson,ls7a-rtc
+          - loongson,ls2k0300-rtc
           - loongson,ls2k1000-rtc
       - items:
           - enum:
@@ -48,6 +49,7 @@ if:
       contains:
         enum:
           - loongson,ls1c-rtc
+          - loongson,ls2k0300-rtc
 
 then:
   properties:
-- 
2.47.3


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

* [PATCH v3 3/3] rtc: loongson: Add Loongson-2K0300 support
  2026-01-17  2:26 [PATCH v3 0/3] RTC: Add Loongson-2K0300 support Binbin Zhou
  2026-01-17  2:26 ` [PATCH v3 1/3] dt-bindings: rtc: loongson: Correct Loongson-1C interrupts property Binbin Zhou
  2026-01-17  2:26 ` [PATCH v3 2/3] dt-bindings: rtc: loongson: Document Loongson-2K0300 compatible Binbin Zhou
@ 2026-01-17  2:26 ` Binbin Zhou
  2026-01-30 23:16 ` [PATCH v3 0/3] RTC: " Alexandre Belloni
  3 siblings, 0 replies; 13+ messages in thread
From: Binbin Zhou @ 2026-01-17  2:26 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Alexandre Belloni, linux-rtc
  Cc: Xiaochuang Mao, Huacai Chen, Xuerui Wang, loongarch, devicetree,
	linux-mips, Keguang Zhang, Binbin Zhou

The Loongson-2K0300's rtc hardware design is similar to that of the
Loongson-1B, but it does not support the alarm feature.

Introduce `LOONGSON_RTC_ALARM_WORKAROUND`, which indicates a chip that
does not support the alarm feature, and rewrite the related logic in
`loongson_rtc_alarm_setting()`.

Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/rtc/rtc-loongson.c | 71 +++++++++++++++++++++++++-------------
 1 file changed, 47 insertions(+), 24 deletions(-)

diff --git a/drivers/rtc/rtc-loongson.c b/drivers/rtc/rtc-loongson.c
index 2ca7ffd5d7a9..066f0644d1c3 100644
--- a/drivers/rtc/rtc-loongson.c
+++ b/drivers/rtc/rtc-loongson.c
@@ -66,7 +66,8 @@
  * According to the LS1C manual, RTC_CTRL and alarm-related registers are not defined.
  * Accessing the relevant registers will cause the system to hang.
  */
-#define LS1C_RTC_CTRL_WORKAROUND	BIT(0)
+#define LOONGSON_RTC_CTRL_WORKAROUND	BIT(0)
+#define LOONGSON_RTC_ALARM_WORKAROUND	BIT(1)
 
 struct loongson_rtc_config {
 	u32 pm_offset;	/* Offset of PM domain, for RTC alarm wakeup */
@@ -89,7 +90,7 @@ static const struct loongson_rtc_config ls1b_rtc_config = {
 
 static const struct loongson_rtc_config ls1c_rtc_config = {
 	.pm_offset = 0,
-	.flags = LS1C_RTC_CTRL_WORKAROUND,
+	.flags = LOONGSON_RTC_CTRL_WORKAROUND | LOONGSON_RTC_ALARM_WORKAROUND,
 };
 
 static const struct loongson_rtc_config generic_rtc_config = {
@@ -97,6 +98,11 @@ static const struct loongson_rtc_config generic_rtc_config = {
 	.flags = 0,
 };
 
+static const struct loongson_rtc_config ls2k0300_rtc_config = {
+	.pm_offset = 0x0,
+	.flags = LOONGSON_RTC_ALARM_WORKAROUND,
+};
+
 static const struct loongson_rtc_config ls2k1000_rtc_config = {
 	.pm_offset = 0x800,
 	.flags = 0,
@@ -153,7 +159,7 @@ static int loongson_rtc_set_enabled(struct device *dev)
 {
 	struct loongson_rtc_priv *priv = dev_get_drvdata(dev);
 
-	if (priv->config->flags & LS1C_RTC_CTRL_WORKAROUND)
+	if (priv->config->flags & LOONGSON_RTC_CTRL_WORKAROUND)
 		return 0;
 
 	/* Enable RTC TOY counters and crystal */
@@ -167,7 +173,7 @@ static bool loongson_rtc_get_enabled(struct device *dev)
 	u32 ctrl_data;
 	struct loongson_rtc_priv *priv = dev_get_drvdata(dev);
 
-	if (priv->config->flags & LS1C_RTC_CTRL_WORKAROUND)
+	if (priv->config->flags & LOONGSON_RTC_CTRL_WORKAROUND)
 		return true;
 
 	ret = regmap_read(priv->regmap, RTC_CTRL_REG, &ctrl_data);
@@ -299,9 +305,41 @@ static const struct rtc_class_ops loongson_rtc_ops = {
 	.alarm_irq_enable = loongson_rtc_alarm_irq_enable,
 };
 
+static int loongson_rtc_alarm_setting(struct platform_device *pdev, void __iomem *regs)
+{
+	int ret = 0, alarm_irq;
+	struct device *dev = &pdev->dev;
+	struct loongson_rtc_priv *priv = dev_get_drvdata(dev);
+
+	if (priv->config->flags & LOONGSON_RTC_ALARM_WORKAROUND) {
+		/* Loongson-1C/Loongson-2K0300 RTC does not support alarm */
+		clear_bit(RTC_FEATURE_ALARM, priv->rtcdev->features);
+		return 0;
+	}
+
+	/* Get RTC alarm irq */
+	alarm_irq = platform_get_irq(pdev, 0);
+	if (alarm_irq < 0)
+		return alarm_irq;
+
+	ret = devm_request_irq(dev, alarm_irq, loongson_rtc_isr, 0, "loongson-alarm",
+			       priv);
+	if (ret < 0)
+		return ret;
+
+	priv->pm_base = regs - priv->config->pm_offset;
+	device_init_wakeup(dev, true);
+
+	if (has_acpi_companion(dev))
+		acpi_install_fixed_event_handler(ACPI_EVENT_RTC,
+						 loongson_rtc_handler, priv);
+
+	return ret;
+}
+
 static int loongson_rtc_probe(struct platform_device *pdev)
 {
-	int ret, alarm_irq;
+	int ret;
 	void __iomem *regs;
 	struct loongson_rtc_priv *priv;
 	struct device *dev = &pdev->dev;
@@ -330,25 +368,9 @@ static int loongson_rtc_probe(struct platform_device *pdev)
 		return dev_err_probe(dev, PTR_ERR(priv->rtcdev),
 				     "devm_rtc_allocate_device failed\n");
 
-	/* Get RTC alarm irq */
-	alarm_irq = platform_get_irq(pdev, 0);
-	if (alarm_irq > 0) {
-		ret = devm_request_irq(dev, alarm_irq, loongson_rtc_isr,
-				       0, "loongson-alarm", priv);
-		if (ret < 0)
-			return dev_err_probe(dev, ret, "Unable to request irq %d\n",
-					     alarm_irq);
-
-		priv->pm_base = regs - priv->config->pm_offset;
-		device_init_wakeup(dev, true);
-
-		if (has_acpi_companion(dev))
-			acpi_install_fixed_event_handler(ACPI_EVENT_RTC,
-							 loongson_rtc_handler, priv);
-	} else {
-		/* Loongson-1C RTC does not support alarm */
-		clear_bit(RTC_FEATURE_ALARM, priv->rtcdev->features);
-	}
+	ret = loongson_rtc_alarm_setting(pdev, regs);
+	if (ret)
+		return ret;
 
 	/* Loongson RTC does not support UIE */
 	clear_bit(RTC_FEATURE_UPDATE_INTERRUPT, priv->rtcdev->features);
@@ -379,6 +401,7 @@ static const struct of_device_id loongson_rtc_of_match[] = {
 	{ .compatible = "loongson,ls1b-rtc", .data = &ls1b_rtc_config },
 	{ .compatible = "loongson,ls1c-rtc", .data = &ls1c_rtc_config },
 	{ .compatible = "loongson,ls7a-rtc", .data = &generic_rtc_config },
+	{ .compatible = "loongson,ls2k0300-rtc", .data = &ls2k0300_rtc_config },
 	{ .compatible = "loongson,ls2k1000-rtc", .data = &ls2k1000_rtc_config },
 	{ /* sentinel */ }
 };
-- 
2.47.3


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

* Re: [PATCH v3 2/3] dt-bindings: rtc: loongson: Document Loongson-2K0300 compatible
  2026-01-17  2:26 ` [PATCH v3 2/3] dt-bindings: rtc: loongson: Document Loongson-2K0300 compatible Binbin Zhou
@ 2026-01-19 18:21   ` Conor Dooley
  0 siblings, 0 replies; 13+ messages in thread
From: Conor Dooley @ 2026-01-19 18:21 UTC (permalink / raw)
  To: Binbin Zhou
  Cc: Binbin Zhou, Huacai Chen, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Alexandre Belloni, linux-rtc, Xiaochuang Mao,
	Huacai Chen, Xuerui Wang, loongarch, devicetree, linux-mips,
	Keguang Zhang

[-- Attachment #1: Type: text/plain, Size: 75 bytes --]

Acked-by: Conor Dooley <conor.dooley@microchip.com>
pw-bot: not-applicable

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [PATCH v3 1/3] dt-bindings: rtc: loongson: Correct Loongson-1C interrupts property
  2026-01-17  2:26 ` [PATCH v3 1/3] dt-bindings: rtc: loongson: Correct Loongson-1C interrupts property Binbin Zhou
@ 2026-01-19 18:24   ` Conor Dooley
  2026-01-20  7:50     ` Alexandre Belloni
  0 siblings, 1 reply; 13+ messages in thread
From: Conor Dooley @ 2026-01-19 18:24 UTC (permalink / raw)
  To: Binbin Zhou
  Cc: Binbin Zhou, Huacai Chen, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Alexandre Belloni, linux-rtc, Xiaochuang Mao,
	Huacai Chen, Xuerui Wang, loongarch, devicetree, linux-mips,
	Keguang Zhang

[-- Attachment #1: Type: text/plain, Size: 1767 bytes --]

On Sat, Jan 17, 2026 at 10:26:48AM +0800, Binbin Zhou wrote:
> The `interrupts` property indicates an RTC alarm interrupt, which is
> required for RTCs that support the alarm feature, which is not supported
> by the Loongson-1C RTC. We exclude it for a more accurate description.
> 
> Changing the `allowed` property is ABI-breaking behavior, but
> throughout the existing Loongson DTS{i}, the description of the RTC
> nodes conforms to the modified bingding rules.

Right, changing properties is an ABI break, but when following the ABI
would've produced something non-functional, breaking it is not really
relevant.
Acked-by: Conor Dooley <conor.dooley@microchip.com>
pw-bot: not-applicable

> 
> Thus, the existing Loongson DTS{i} will not be affected.
> 
> Fixes: 487ef32caebe ("dt-bindings: rtc: Split loongson,ls2x-rtc into SoC-based compatibles")
> Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
> Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
> ---
>  .../devicetree/bindings/rtc/loongson,rtc.yaml         | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/rtc/loongson,rtc.yaml b/Documentation/devicetree/bindings/rtc/loongson,rtc.yaml
> index f89c1f660aee..fac90a18153e 100644
> --- a/Documentation/devicetree/bindings/rtc/loongson,rtc.yaml
> +++ b/Documentation/devicetree/bindings/rtc/loongson,rtc.yaml
> @@ -42,6 +42,17 @@ required:
>  
>  unevaluatedProperties: false
>  
> +if:
> +  properties:
> +    compatible:
> +      contains:
> +        enum:
> +          - loongson,ls1c-rtc
> +
> +then:
> +  properties:
> +    interrupts: false
> +
>  examples:
>    - |
>      #include <dt-bindings/interrupt-controller/irq.h>
> -- 
> 2.47.3
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [PATCH v3 1/3] dt-bindings: rtc: loongson: Correct Loongson-1C interrupts property
  2026-01-19 18:24   ` Conor Dooley
@ 2026-01-20  7:50     ` Alexandre Belloni
  2026-01-20 19:24       ` Conor Dooley
  0 siblings, 1 reply; 13+ messages in thread
From: Alexandre Belloni @ 2026-01-20  7:50 UTC (permalink / raw)
  To: Conor Dooley
  Cc: Binbin Zhou, Binbin Zhou, Huacai Chen, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, linux-rtc, Xiaochuang Mao,
	Huacai Chen, Xuerui Wang, loongarch, devicetree, linux-mips,
	Keguang Zhang

On 19/01/2026 18:24:36+0000, Conor Dooley wrote:
> On Sat, Jan 17, 2026 at 10:26:48AM +0800, Binbin Zhou wrote:
> > The `interrupts` property indicates an RTC alarm interrupt, which is
> > required for RTCs that support the alarm feature, which is not supported
> > by the Loongson-1C RTC. We exclude it for a more accurate description.
> > 
> > Changing the `allowed` property is ABI-breaking behavior, but
> > throughout the existing Loongson DTS{i}, the description of the RTC
> > nodes conforms to the modified bingding rules.
> 
> Right, changing properties is an ABI break, but when following the ABI
> would've produced something non-functional, breaking it is not really
> relevant.


But the HW has the interrupt, the fact that is not functional doesn't
mean it isn't there. I thought we should describe the hardware?

> Acked-by: Conor Dooley <conor.dooley@microchip.com>
> pw-bot: not-applicable
> 
> > 
> > Thus, the existing Loongson DTS{i} will not be affected.
> > 
> > Fixes: 487ef32caebe ("dt-bindings: rtc: Split loongson,ls2x-rtc into SoC-based compatibles")
> > Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
> > Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
> > ---
> >  .../devicetree/bindings/rtc/loongson,rtc.yaml         | 11 +++++++++++
> >  1 file changed, 11 insertions(+)
> > 
> > diff --git a/Documentation/devicetree/bindings/rtc/loongson,rtc.yaml b/Documentation/devicetree/bindings/rtc/loongson,rtc.yaml
> > index f89c1f660aee..fac90a18153e 100644
> > --- a/Documentation/devicetree/bindings/rtc/loongson,rtc.yaml
> > +++ b/Documentation/devicetree/bindings/rtc/loongson,rtc.yaml
> > @@ -42,6 +42,17 @@ required:
> >  
> >  unevaluatedProperties: false
> >  
> > +if:
> > +  properties:
> > +    compatible:
> > +      contains:
> > +        enum:
> > +          - loongson,ls1c-rtc
> > +
> > +then:
> > +  properties:
> > +    interrupts: false
> > +
> >  examples:
> >    - |
> >      #include <dt-bindings/interrupt-controller/irq.h>
> > -- 
> > 2.47.3
> > 



-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

* Re: [PATCH v3 1/3] dt-bindings: rtc: loongson: Correct Loongson-1C interrupts property
  2026-01-20  7:50     ` Alexandre Belloni
@ 2026-01-20 19:24       ` Conor Dooley
  2026-01-20 22:49         ` Alexandre Belloni
  0 siblings, 1 reply; 13+ messages in thread
From: Conor Dooley @ 2026-01-20 19:24 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: Binbin Zhou, Binbin Zhou, Huacai Chen, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, linux-rtc, Xiaochuang Mao,
	Huacai Chen, Xuerui Wang, loongarch, devicetree, linux-mips,
	Keguang Zhang

[-- Attachment #1: Type: text/plain, Size: 2671 bytes --]

On Tue, Jan 20, 2026 at 08:50:45AM +0100, Alexandre Belloni wrote:
> On 19/01/2026 18:24:36+0000, Conor Dooley wrote:
> > On Sat, Jan 17, 2026 at 10:26:48AM +0800, Binbin Zhou wrote:
> > > The `interrupts` property indicates an RTC alarm interrupt, which is
> > > required for RTCs that support the alarm feature, which is not supported
> > > by the Loongson-1C RTC. We exclude it for a more accurate description.
> > > 
> > > Changing the `allowed` property is ABI-breaking behavior, but
> > > throughout the existing Loongson DTS{i}, the description of the RTC
> > > nodes conforms to the modified bingding rules.
> > 
> > Right, changing properties is an ABI break, but when following the ABI
> > would've produced something non-functional, breaking it is not really
> > relevant.
> 
> 
> But the HW has the interrupt, the fact that is not functional doesn't
> mean it isn't there. I thought we should describe the hardware?

Does the hardware have it? My interpretation of the commit message was
that it didn't have the alarm feature and thus no interrupt? Unless the
interrupt has some other purpose, in which case yeah we shouldn't accept
this change and only the new device should permit there being no
interrupt.

> 
> > Acked-by: Conor Dooley <conor.dooley@microchip.com>
> > pw-bot: not-applicable
> > 
> > > 
> > > Thus, the existing Loongson DTS{i} will not be affected.
> > > 
> > > Fixes: 487ef32caebe ("dt-bindings: rtc: Split loongson,ls2x-rtc into SoC-based compatibles")
> > > Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
> > > Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
> > > ---
> > >  .../devicetree/bindings/rtc/loongson,rtc.yaml         | 11 +++++++++++
> > >  1 file changed, 11 insertions(+)
> > > 
> > > diff --git a/Documentation/devicetree/bindings/rtc/loongson,rtc.yaml b/Documentation/devicetree/bindings/rtc/loongson,rtc.yaml
> > > index f89c1f660aee..fac90a18153e 100644
> > > --- a/Documentation/devicetree/bindings/rtc/loongson,rtc.yaml
> > > +++ b/Documentation/devicetree/bindings/rtc/loongson,rtc.yaml
> > > @@ -42,6 +42,17 @@ required:
> > >  
> > >  unevaluatedProperties: false
> > >  
> > > +if:
> > > +  properties:
> > > +    compatible:
> > > +      contains:
> > > +        enum:
> > > +          - loongson,ls1c-rtc
> > > +
> > > +then:
> > > +  properties:
> > > +    interrupts: false
> > > +
> > >  examples:
> > >    - |
> > >      #include <dt-bindings/interrupt-controller/irq.h>
> > > -- 
> > > 2.47.3
> > > 
> 
> 
> 
> -- 
> Alexandre Belloni, co-owner and COO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [PATCH v3 1/3] dt-bindings: rtc: loongson: Correct Loongson-1C interrupts property
  2026-01-20 19:24       ` Conor Dooley
@ 2026-01-20 22:49         ` Alexandre Belloni
  2026-01-20 23:39           ` Conor Dooley
  0 siblings, 1 reply; 13+ messages in thread
From: Alexandre Belloni @ 2026-01-20 22:49 UTC (permalink / raw)
  To: Conor Dooley
  Cc: Binbin Zhou, Binbin Zhou, Huacai Chen, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, linux-rtc, Xiaochuang Mao,
	Huacai Chen, Xuerui Wang, loongarch, devicetree, linux-mips,
	Keguang Zhang

On 20/01/2026 19:24:09+0000, Conor Dooley wrote:
> On Tue, Jan 20, 2026 at 08:50:45AM +0100, Alexandre Belloni wrote:
> > On 19/01/2026 18:24:36+0000, Conor Dooley wrote:
> > > On Sat, Jan 17, 2026 at 10:26:48AM +0800, Binbin Zhou wrote:
> > > > The `interrupts` property indicates an RTC alarm interrupt, which is
> > > > required for RTCs that support the alarm feature, which is not supported
> > > > by the Loongson-1C RTC. We exclude it for a more accurate description.
> > > > 
> > > > Changing the `allowed` property is ABI-breaking behavior, but
> > > > throughout the existing Loongson DTS{i}, the description of the RTC
> > > > nodes conforms to the modified bingding rules.
> > > 
> > > Right, changing properties is an ABI break, but when following the ABI
> > > would've produced something non-functional, breaking it is not really
> > > relevant.
> > 
> > 
> > But the HW has the interrupt, the fact that is not functional doesn't
> > mean it isn't there. I thought we should describe the hardware?
> 
> Does the hardware have it? My interpretation of the commit message was
> that it didn't have the alarm feature and thus no interrupt? Unless the
> interrupt has some other purpose, in which case yeah we shouldn't accept
> this change and only the new device should permit there being no
> interrupt.

The datasheet shows the interrupt coming out of the RTC and it has the
proper registers. Why it is not functional is not clear to me.

-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

* Re: [PATCH v3 1/3] dt-bindings: rtc: loongson: Correct Loongson-1C interrupts property
  2026-01-20 22:49         ` Alexandre Belloni
@ 2026-01-20 23:39           ` Conor Dooley
  2026-01-21  6:52             ` Binbin Zhou
  0 siblings, 1 reply; 13+ messages in thread
From: Conor Dooley @ 2026-01-20 23:39 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: Binbin Zhou, Binbin Zhou, Huacai Chen, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, linux-rtc, Xiaochuang Mao,
	Huacai Chen, Xuerui Wang, loongarch, devicetree, linux-mips,
	Keguang Zhang

[-- Attachment #1: Type: text/plain, Size: 1733 bytes --]

On Tue, Jan 20, 2026 at 11:49:20PM +0100, Alexandre Belloni wrote:
> On 20/01/2026 19:24:09+0000, Conor Dooley wrote:
> > On Tue, Jan 20, 2026 at 08:50:45AM +0100, Alexandre Belloni wrote:
> > > On 19/01/2026 18:24:36+0000, Conor Dooley wrote:
> > > > On Sat, Jan 17, 2026 at 10:26:48AM +0800, Binbin Zhou wrote:
> > > > > The `interrupts` property indicates an RTC alarm interrupt, which is
> > > > > required for RTCs that support the alarm feature, which is not supported
> > > > > by the Loongson-1C RTC. We exclude it for a more accurate description.
> > > > > 
> > > > > Changing the `allowed` property is ABI-breaking behavior, but
> > > > > throughout the existing Loongson DTS{i}, the description of the RTC
> > > > > nodes conforms to the modified bingding rules.
> > > > 
> > > > Right, changing properties is an ABI break, but when following the ABI
> > > > would've produced something non-functional, breaking it is not really
> > > > relevant.
> > > 
> > > 
> > > But the HW has the interrupt, the fact that is not functional doesn't
> > > mean it isn't there. I thought we should describe the hardware?
> > 
> > Does the hardware have it? My interpretation of the commit message was
> > that it didn't have the alarm feature and thus no interrupt? Unless the
> > interrupt has some other purpose, in which case yeah we shouldn't accept
> > this change and only the new device should permit there being no
> > interrupt.
> 
> The datasheet shows the interrupt coming out of the RTC and it has the
> proper registers. Why it is not functional is not clear to me.

Right.. Perhaps Binbin can explain that then? If the interrupt is
actually there then the dts should get fixed instead IMO.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [PATCH v3 1/3] dt-bindings: rtc: loongson: Correct Loongson-1C interrupts property
  2026-01-20 23:39           ` Conor Dooley
@ 2026-01-21  6:52             ` Binbin Zhou
  2026-01-21 18:28               ` Conor Dooley
  0 siblings, 1 reply; 13+ messages in thread
From: Binbin Zhou @ 2026-01-21  6:52 UTC (permalink / raw)
  To: Conor Dooley
  Cc: Alexandre Belloni, Binbin Zhou, Huacai Chen, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, linux-rtc, Xiaochuang Mao,
	Huacai Chen, Xuerui Wang, loongarch, devicetree, linux-mips,
	Keguang Zhang

Hi Conor & Alexandre:

Thanks for your reply.

On Wed, Jan 21, 2026 at 7:39 AM Conor Dooley <conor@kernel.org> wrote:
>
> On Tue, Jan 20, 2026 at 11:49:20PM +0100, Alexandre Belloni wrote:
> > On 20/01/2026 19:24:09+0000, Conor Dooley wrote:
> > > On Tue, Jan 20, 2026 at 08:50:45AM +0100, Alexandre Belloni wrote:
> > > > On 19/01/2026 18:24:36+0000, Conor Dooley wrote:
> > > > > On Sat, Jan 17, 2026 at 10:26:48AM +0800, Binbin Zhou wrote:
> > > > > > The `interrupts` property indicates an RTC alarm interrupt, which is
> > > > > > required for RTCs that support the alarm feature, which is not supported
> > > > > > by the Loongson-1C RTC. We exclude it for a more accurate description.
> > > > > >
> > > > > > Changing the `allowed` property is ABI-breaking behavior, but
> > > > > > throughout the existing Loongson DTS{i}, the description of the RTC
> > > > > > nodes conforms to the modified bingding rules.
> > > > >
> > > > > Right, changing properties is an ABI break, but when following the ABI
> > > > > would've produced something non-functional, breaking it is not really
> > > > > relevant.
> > > >
> > > >
> > > > But the HW has the interrupt, the fact that is not functional doesn't
> > > > mean it isn't there. I thought we should describe the hardware?
> > >
> > > Does the hardware have it? My interpretation of the commit message was
> > > that it didn't have the alarm feature and thus no interrupt? Unless the
> > > interrupt has some other purpose, in which case yeah we shouldn't accept
> > > this change and only the new device should permit there being no
> > > interrupt.
> >
> > The datasheet shows the interrupt coming out of the RTC and it has the
> > proper registers. Why it is not functional is not clear to me.
>
> Right.. Perhaps Binbin can explain that then? If the interrupt is
> actually there then the dts should get fixed instead IMO.

I carefully reviewed the manual again and believe this patch is still necessary.

First, the Loongson-1C RTC does not define the timing interrupt
register (`TOY_MATCH0_REG`)[1], meaning it lacks hardware support for
alarms. Consequently, `interrupts` are also unnecessary.
The Loongson-2K0300 is different. It defines `TOY_MATCH0_REG`, but due
to a hardware design flaw, accessing this register causes system
crashes. Therefore, I must also classify it as lacking alarm support.

Additionally, in patch-3 [2], I rewrote the alarm logic to decouple
the `interrupts` property from the alarm feature: I defined
corresponding workaround bits in `loongson_rtc_config->flags`. This
should be considered a SoC-specific attribute.

Finally, two thoughts:
1. Retain this patch; it is correct for Loongson-1C.
2. For Patch-2, still add the `interrupts` property to the
Loongson-2K0300 RTC node (as it exists in hardware), combined with the
workaround bit setting in patch-3 to avoid the hardware flaw.

Would this approach be acceptable?

[1]: https://www.loongson.cn/uploads/images/2022051616223977135.%E9%BE%99%E8%8A%AF1C300%E5%A4%84%E7%90%86%E5%99%A8%E7%94%A8%E6%88%B7%E6%89%8B%E5%86%8C.pdf
(section 21.2.1)
[2]: https://lore.kernel.org/linux-rtc/abff68dda2fe6a6601a9e58b31e278d941297fce.1768616276.git.zhoubinbin@loongson.cn/

--
Thanks.
Binbin

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

* Re: [PATCH v3 1/3] dt-bindings: rtc: loongson: Correct Loongson-1C interrupts property
  2026-01-21  6:52             ` Binbin Zhou
@ 2026-01-21 18:28               ` Conor Dooley
  0 siblings, 0 replies; 13+ messages in thread
From: Conor Dooley @ 2026-01-21 18:28 UTC (permalink / raw)
  To: Binbin Zhou
  Cc: Alexandre Belloni, Binbin Zhou, Huacai Chen, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, linux-rtc, Xiaochuang Mao,
	Huacai Chen, Xuerui Wang, loongarch, devicetree, linux-mips,
	Keguang Zhang

[-- Attachment #1: Type: text/plain, Size: 4255 bytes --]

On Wed, Jan 21, 2026 at 02:52:06PM +0800, Binbin Zhou wrote:
> Hi Conor & Alexandre:
> 
> Thanks for your reply.
> 
> On Wed, Jan 21, 2026 at 7:39 AM Conor Dooley <conor@kernel.org> wrote:
> >
> > On Tue, Jan 20, 2026 at 11:49:20PM +0100, Alexandre Belloni wrote:
> > > On 20/01/2026 19:24:09+0000, Conor Dooley wrote:
> > > > On Tue, Jan 20, 2026 at 08:50:45AM +0100, Alexandre Belloni wrote:
> > > > > On 19/01/2026 18:24:36+0000, Conor Dooley wrote:
> > > > > > On Sat, Jan 17, 2026 at 10:26:48AM +0800, Binbin Zhou wrote:
> > > > > > > The `interrupts` property indicates an RTC alarm interrupt, which is
> > > > > > > required for RTCs that support the alarm feature, which is not supported
> > > > > > > by the Loongson-1C RTC. We exclude it for a more accurate description.
> > > > > > >
> > > > > > > Changing the `allowed` property is ABI-breaking behavior, but
> > > > > > > throughout the existing Loongson DTS{i}, the description of the RTC
> > > > > > > nodes conforms to the modified bingding rules.
> > > > > >
> > > > > > Right, changing properties is an ABI break, but when following the ABI
> > > > > > would've produced something non-functional, breaking it is not really
> > > > > > relevant.
> > > > >
> > > > >
> > > > > But the HW has the interrupt, the fact that is not functional doesn't
> > > > > mean it isn't there. I thought we should describe the hardware?
> > > >
> > > > Does the hardware have it? My interpretation of the commit message was
> > > > that it didn't have the alarm feature and thus no interrupt? Unless the
> > > > interrupt has some other purpose, in which case yeah we shouldn't accept
> > > > this change and only the new device should permit there being no
> > > > interrupt.
> > >
> > > The datasheet shows the interrupt coming out of the RTC and it has the
> > > proper registers. Why it is not functional is not clear to me.
> >
> > Right.. Perhaps Binbin can explain that then? If the interrupt is
> > actually there then the dts should get fixed instead IMO.
> 
> I carefully reviewed the manual again and believe this patch is still necessary.
> 
> First, the Loongson-1C RTC does not define the timing interrupt
> register (`TOY_MATCH0_REG`)[1], meaning it lacks hardware support for

I don't understand Chinese, so I'll take your word for it that this
particular model doesn't have this interrupt and that there's no other
interrupt used by the rtc via a different register :) My ack for the
patch remains valid.

Also, I looked at the existing binding again, and there's no ABI break
anyway cos the interrupts property wasn't required in the first place,
so any driver has to be written to permit the absence of an interrupts
property. I think you should remove mention of ABI break from the commit
message, since it's not actually one.

> alarms. Consequently, `interrupts` are also unnecessary.
> The Loongson-2K0300 is different. It defines `TOY_MATCH0_REG`, but due
> to a hardware design flaw, accessing this register causes system
> crashes. Therefore, I must also classify it as lacking alarm support.

This logic also seems fair to me, assuming that this is the only
interrupt that the device has.

> Additionally, in patch-3 [2], I rewrote the alarm logic to decouple
> the `interrupts` property from the alarm feature: I defined
> corresponding workaround bits in `loongson_rtc_config->flags`. This
> should be considered a SoC-specific attribute.
> 
> Finally, two thoughts:
> 1. Retain this patch; it is correct for Loongson-1C.
> 2. For Patch-2, still add the `interrupts` property to the
> Loongson-2K0300 RTC node (as it exists in hardware), combined with the
> workaround bit setting in patch-3 to avoid the hardware flaw.

Personally, I think what you've done in patch 2 is okay, since that
interrupt is non-functional.

> 
> Would this approach be acceptable?
> 
> [1]: https://www.loongson.cn/uploads/images/2022051616223977135.%E9%BE%99%E8%8A%AF1C300%E5%A4%84%E7%90%86%E5%99%A8%E7%94%A8%E6%88%B7%E6%89%8B%E5%86%8C.pdf
> (section 21.2.1)
> [2]: https://lore.kernel.org/linux-rtc/abff68dda2fe6a6601a9e58b31e278d941297fce.1768616276.git.zhoubinbin@loongson.cn/
> 
> --
> Thanks.
> Binbin

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [PATCH v3 0/3] RTC: Add Loongson-2K0300 support
  2026-01-17  2:26 [PATCH v3 0/3] RTC: Add Loongson-2K0300 support Binbin Zhou
                   ` (2 preceding siblings ...)
  2026-01-17  2:26 ` [PATCH v3 3/3] rtc: loongson: Add Loongson-2K0300 support Binbin Zhou
@ 2026-01-30 23:16 ` Alexandre Belloni
  3 siblings, 0 replies; 13+ messages in thread
From: Alexandre Belloni @ 2026-01-30 23:16 UTC (permalink / raw)
  To: Binbin Zhou, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	linux-rtc, Huacai Chen, Binbin Zhou
  Cc: Xiaochuang Mao, Huacai Chen, Xuerui Wang, loongarch, devicetree,
	linux-mips, Keguang Zhang

On Sat, 17 Jan 2026 10:26:47 +0800, Binbin Zhou wrote:
> This patch set introduces the Loongson-2K0300 RTC, which has a similar
> hardware design to the Loongson-1B, but without the alarm feature.
> 
> Thanks.
> Binbin
> 
> ==========
> V3:
> - Add Reviewed-by tag from Huacai, thanks.
> 
> [...]

Applied, thanks!

[1/3] dt-bindings: rtc: loongson: Correct Loongson-1C interrupts property
      https://git.kernel.org/abelloni/c/da9934a6583a
[2/3] dt-bindings: rtc: loongson: Document Loongson-2K0300 compatible
      https://git.kernel.org/abelloni/c/5d4899d4859f
[3/3] rtc: loongson: Add Loongson-2K0300 support
      https://git.kernel.org/abelloni/c/770a54accf80

Best regards,

-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

end of thread, other threads:[~2026-01-30 23:16 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-17  2:26 [PATCH v3 0/3] RTC: Add Loongson-2K0300 support Binbin Zhou
2026-01-17  2:26 ` [PATCH v3 1/3] dt-bindings: rtc: loongson: Correct Loongson-1C interrupts property Binbin Zhou
2026-01-19 18:24   ` Conor Dooley
2026-01-20  7:50     ` Alexandre Belloni
2026-01-20 19:24       ` Conor Dooley
2026-01-20 22:49         ` Alexandre Belloni
2026-01-20 23:39           ` Conor Dooley
2026-01-21  6:52             ` Binbin Zhou
2026-01-21 18:28               ` Conor Dooley
2026-01-17  2:26 ` [PATCH v3 2/3] dt-bindings: rtc: loongson: Document Loongson-2K0300 compatible Binbin Zhou
2026-01-19 18:21   ` Conor Dooley
2026-01-17  2:26 ` [PATCH v3 3/3] rtc: loongson: Add Loongson-2K0300 support Binbin Zhou
2026-01-30 23:16 ` [PATCH v3 0/3] RTC: " Alexandre Belloni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox