Skip to contentSkip to conversation

RTC: Add Loongson-2K0300 support

PATCH Applied Binbin Zhou 4 participants 13 messages Jan 17 – Jan 30

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v3 cover RTC: Add Loongson-2K0300 support

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/[email protected]/

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/[email protected]/

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

Signature · 1 line
2.47.3
#1 lore raw

PATCH v3 1/3 dt-bindings: rtc: loongson: Correct Loongson-1C interrupts property

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")
---
 .../devicetree/bindings/rtc/loongson,rtc.yaml         | 11 +++++++++++
 1 file changed, 11 insertions(+)
Documentation/devicetree/bindings/rtc/loongson,rtc.yaml +11 -0
index f89c1f660aee..fac90a18153e 100644
@@ -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>
Signature · 1 line
2.47.3
Acked-by on v3 1/3
#2 lore raw

Re: [PATCH v3 1/3] dt-bindings: rtc: loongson: Correct Loongson-1C interrupts property

Quoted 7 lines · 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.

Right, changing properties is an ABI break, but when following the ABI would've produced something non-functional, breaking it is not really relevant.

pw-bot: not-applicable

Quoted 35 lines

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

Fixes 487ef32caebe ("dt-bindings: rtc: Split loongson,ls2x-rtc into SoC-based compatibles")
---
 .../devicetree/bindings/rtc/loongson,rtc.yaml         | 11 +++++++++++
 1 file changed, 11 insertions(+)
Documentation/devicetree/bindings/rtc/loongson,rtc.yaml +11 -0
index f89c1f660aee..fac90a18153e 100644
@@ -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>
Signature · 1 line
2.47.3
#3 lore raw

Re: [PATCH v3 1/3] dt-bindings: rtc: loongson: Correct Loongson-1C interrupts property

Quoted 5 lines · Conor Dooley
Quoted 4 lines · 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.

Quoted 7 lines
Quoted 3 lines

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?

Quoted 38 lines

pw-bot: not-applicable

Quoted 35 lines

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

Fixes 487ef32caebe ("dt-bindings: rtc: Split loongson,ls2x-rtc into SoC-based compatibles")
---
 .../devicetree/bindings/rtc/loongson,rtc.yaml         | 11 +++++++++++
 1 file changed, 11 insertions(+)
Documentation/devicetree/bindings/rtc/loongson,rtc.yaml +11 -0
index f89c1f660aee..fac90a18153e 100644
@@ -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>
Signature · 1 line
2.47.3
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#4 lore raw

Re: [PATCH v3 1/3] dt-bindings: rtc: loongson: Correct Loongson-1C interrupts property

Quoted 10 lines · Alexandre Belloni
Quoted 9 lines · Conor Dooley
Quoted 7 lines · 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.

Quoted 7 lines
Quoted 3 lines

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.

Quoted 46 lines
Quoted 39 lines

pw-bot: not-applicable

Quoted 35 lines

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

Fixes 487ef32caebe ("dt-bindings: rtc: Split loongson,ls2x-rtc into SoC-based compatibles")
---
 .../devicetree/bindings/rtc/loongson,rtc.yaml         | 11 +++++++++++
 1 file changed, 11 insertions(+)
Documentation/devicetree/bindings/rtc/loongson,rtc.yaml +11 -0
index f89c1f660aee..fac90a18153e 100644
@@ -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>
Signature · 1 line
2.47.3
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#5 lore raw

Re: [PATCH v3 1/3] dt-bindings: rtc: loongson: Correct Loongson-1C interrupts property

Quoted 16 lines · Conor Dooley
Quoted 15 lines · Alexandre Belloni
Quoted 12 lines · Conor Dooley
Quoted 7 lines · 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.

Right, changing properties is an ABI break, but when following the ABI would've produced something non-functional, breaking it is not really relevant.

Quoted 8 lines
Quoted 2 lines

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.

Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#6 lore raw

Re: [PATCH v3 1/3] dt-bindings: rtc: loongson: Correct Loongson-1C interrupts property

Quoted 20 lines · Alexandre Belloni
Quoted 19 lines · Conor Dooley
Quoted 17 lines · Alexandre Belloni
Quoted 5 lines · Conor Dooley
Quoted 4 lines · 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.

Quoted 7 lines
Quoted 3 lines

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?

Quoted 8 lines
Quoted 5 lines

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.

#7 lore raw

Re: [PATCH v3 1/3] dt-bindings: rtc: loongson: Correct Loongson-1C interrupts property

Hi Conor & Alexandre:

Thanks for your reply.

Quoted 28 lines · Conor Dooley
Quoted 26 lines · Alexandre Belloni
Quoted 24 lines · Conor Dooley
Quoted 10 lines · Alexandre Belloni
Quoted 9 lines · Conor Dooley
Quoted 7 lines · 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.

Quoted 7 lines
Quoted 3 lines

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.

Quoted 5 lines
Quoted 2 lines

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

#8 lore raw

Re: [PATCH v3 1/3] dt-bindings: rtc: loongson: Correct Loongson-1C interrupts property

Quoted 36 lines · Binbin Zhou

Hi Conor & Alexandre:

Thanks for your reply.

Quoted 31 lines · Conor Dooley
Quoted 28 lines · Alexandre Belloni
Quoted 16 lines · Conor Dooley
Quoted 15 lines · Alexandre Belloni
Quoted 12 lines · Conor Dooley
Quoted 7 lines · 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.

Right, changing properties is an ABI break, but when following the ABI would've produced something non-functional, breaking it is not really relevant.

Quoted 8 lines
Quoted 2 lines

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.

Quoted 7 lines
Quoted 2 lines

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.

Quoted 4 lines

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.

Quoted 10 lines

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.

Quoted 10 lines

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

#9 lore raw

PATCH v3 2/3 dt-bindings: rtc: loongson: Document Loongson-2K0300 compatible

In reply to 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.

---
 Documentation/devicetree/bindings/rtc/loongson,rtc.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/rtc/loongson,rtc.yaml +2 -0
index fac90a18153e..aac91c79ffdb 100644
@@ -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:
Signature · 1 line
2.47.3
#11 lore raw

PATCH v3 3/3 rtc: loongson: Add Loongson-2K0300 support

In reply to 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().

---
 drivers/rtc/rtc-loongson.c | 71 +++++++++++++++++++++++++-------------
 1 file changed, 47 insertions(+), 24 deletions(-)
drivers/rtc/rtc-loongson.c +47 -24
index 2ca7ffd5d7a9..066f0644d1c3 100644
@@ -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 */ }
 };
Signature · 1 line
2.47.3
maintainer Applied
#12 lore raw
In reply to Binbin Zhou
Quoted 11 lines · Binbin Zhou

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,

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