linux-rtc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND v5 0/6] rtc: ls2x: Add support for the Loongson-2K/LS7A RTC
@ 2021-08-23 16:31 WANG Xuerui
  2021-08-23 16:31 ` [PATCH RESEND v5 1/6] " WANG Xuerui
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: WANG Xuerui @ 2021-08-23 16:31 UTC (permalink / raw)
  To: linux-rtc; +Cc: WANG Xuerui, Alexandre Belloni, linux-mips, devicetree

I'm resending the series after waiting for seven rc's without any response;
did I overlook any submission procedure? Rebased against current rtc-next
and tweaked Cc's for this submission, though.

This is all compiled and tested on a 3A4000 box, as usual. 3A3000+7A and
2K systems are tested previously, and these should not be affected. (To
Loongson employees reading this: please test on your rigs and give
feedback, for getting this done before the next merge window!)

While we're at it, I'd like to know which tree should this series go in via;
is it rtc-next or mips-next? I'd prefer mips-next, since the last 4 patches
all deal with MIPS things.


Original cover letter:

This patch series adds support for the RTC module found on various
Loongson systems with the Loongson-2K SoC or the LS7A bridge chip.
The driver is rewritten from an out-of-tree version to meet mainline
standards. I write kernel code as a hobby, though, so there might still
be overlooked issues. Any suggestions are welcome.

v5:
- Minor changes per Nobuhiro-san's review
  - Simplified one register-write-and-return
  - Explicitly depend on OF, remove of_match_ptr usage for now
- Tested on Loongson-3A4000; 2K should work too because there's no
  functional change either

v4:
- Rebased on top of next-20210628
- Added Jiaxun's Tested-by tag for Loongson-2K; no functional changes
- Addressed all review comments from v3
  - Rewritten field operations with FIELD_GET/FIELD_PREP
  - Removed all error logs
  - Removed unnecessary spinlocking (RTC core already protects against
    concurrent device file operations)

v3:
- Fixed compile error not discovered after rebase (blame sleep
  deprivation)
- Tested on Loongson-3A4000 and Loongson-2K

v2:
- Rebased on top of latest linux-next
- Updated Huacai's e-mail address to the kernel.org one
- Added collected tags
- Added adaptation for newly upstreamed Loongson-2K platforms

WANG Xuerui (6):
  rtc: ls2x: Add support for the Loongson-2K/LS7A RTC
  dt-bindings: rtc: Add bindings for LS2X RTC
  MIPS: Loongson64: DTS: Add RTC support to LS7A
  MIPS: Loongson: Enable LS2X RTC in loongson3_defconfig
  MIPS: Loongson64: DTS: Add RTC support to Loongson-2K
  MIPS: Loongson: Enable LS2X RTC in loongson2k_defconfig

 .../devicetree/bindings/rtc/trivial-rtc.yaml  |   2 +
 .../boot/dts/loongson/loongson64-2k1000.dtsi  |   5 +
 arch/mips/boot/dts/loongson/ls7a-pch.dtsi     |   5 +
 arch/mips/configs/loongson2k_defconfig        |   1 +
 arch/mips/configs/loongson3_defconfig         |   1 +
 drivers/rtc/Kconfig                           |  11 ++
 drivers/rtc/Makefile                          |   1 +
 drivers/rtc/rtc-ls2x.c                        | 180 ++++++++++++++++++
 8 files changed, 206 insertions(+)
 create mode 100644 drivers/rtc/rtc-ls2x.c


base-commit: 8158da6a33f2656c2a98c30eb9185a44e215a6b6
-- 
2.33.0


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

* [PATCH RESEND v5 1/6] rtc: ls2x: Add support for the Loongson-2K/LS7A RTC
  2021-08-23 16:31 [PATCH RESEND v5 0/6] rtc: ls2x: Add support for the Loongson-2K/LS7A RTC WANG Xuerui
@ 2021-08-23 16:31 ` WANG Xuerui
  2021-08-31  0:33   ` Nobuhiro Iwamatsu
                     ` (2 more replies)
  2021-08-23 16:31 ` [PATCH RESEND v5 2/6] dt-bindings: rtc: Add bindings for LS2X RTC WANG Xuerui
                   ` (4 subsequent siblings)
  5 siblings, 3 replies; 10+ messages in thread
From: WANG Xuerui @ 2021-08-23 16:31 UTC (permalink / raw)
  To: linux-rtc
  Cc: WANG Xuerui, Huacai Chen, Jiaxun Yang, Alexandre Belloni,
	devicetree, linux-mips

This RTC module is integrated into the Loongson-2K SoC and the LS7A
bridge chip. This version is almost entirely rewritten to make use of
current kernel API.

Signed-off-by: Huacai Chen <chenhuacai@kernel.org>
Signed-off-by: WANG Xuerui <git@xen0n.name>
Tested-by: Jiaxun Yang <jiaxun.yang@flygoat.com> # loongson2k
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: devicetree@vger.kernel.org
Cc: linux-mips@vger.kernel.org
---
 drivers/rtc/Kconfig    |  11 +++
 drivers/rtc/Makefile   |   1 +
 drivers/rtc/rtc-ls2x.c | 180 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 192 insertions(+)
 create mode 100644 drivers/rtc/rtc-ls2x.c

diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index daff06707455..819f366b4d91 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -1313,6 +1313,17 @@ config RTC_DRV_NTXEC
 	  embedded controller found in certain e-book readers designed by the
 	  original design manufacturer Netronix.
 
+config RTC_DRV_LS2X
+	tristate "Loongson LS2X RTC"
+	depends on OF && MACH_LOONGSON64 || COMPILE_TEST
+	select REGMAP_MMIO
+	help
+	  If you say yes here you get support for the RTC on the Loongson-2K
+	  SoC and LS7A bridge, which first appeared on the Loongson-2H.
+
+	  This driver can also be built as a module. If so, the module
+	  will be called rtc-ls2x.
+
 comment "on-CPU RTC drivers"
 
 config RTC_DRV_ASM9260
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
index 5ceeafe4d5b2..98e68484f519 100644
--- a/drivers/rtc/Makefile
+++ b/drivers/rtc/Makefile
@@ -83,6 +83,7 @@ obj-$(CONFIG_RTC_DRV_LOONGSON1)	+= rtc-ls1x.o
 obj-$(CONFIG_RTC_DRV_LP8788)	+= rtc-lp8788.o
 obj-$(CONFIG_RTC_DRV_LPC24XX)	+= rtc-lpc24xx.o
 obj-$(CONFIG_RTC_DRV_LPC32XX)	+= rtc-lpc32xx.o
+obj-$(CONFIG_RTC_DRV_LS2X)	+= rtc-ls2x.o
 obj-$(CONFIG_RTC_DRV_M41T80)	+= rtc-m41t80.o
 obj-$(CONFIG_RTC_DRV_M41T93)	+= rtc-m41t93.o
 obj-$(CONFIG_RTC_DRV_M41T94)	+= rtc-m41t94.o
diff --git a/drivers/rtc/rtc-ls2x.c b/drivers/rtc/rtc-ls2x.c
new file mode 100644
index 000000000000..58901323b219
--- /dev/null
+++ b/drivers/rtc/rtc-ls2x.c
@@ -0,0 +1,180 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Loongson-2K/7A RTC driver
+ *
+ * Based on the original out-of-tree Loongson-2H RTC driver for Linux 2.6.32,
+ * by Shaozong Liu <liushaozong@loongson.cn>.
+ *
+ * Maintained out-of-tree by Huacai Chen <chenhuacai@kernel.org>.
+ *
+ * Rewritten for mainline by WANG Xuerui <git@xen0n.name>.
+ */
+
+#include <linux/bitfield.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+#include <linux/rtc.h>
+
+#define TOY_TRIM_REG   0x20
+#define TOY_WRITE0_REG 0x24
+#define TOY_WRITE1_REG 0x28
+#define TOY_READ0_REG  0x2c
+#define TOY_READ1_REG  0x30
+#define TOY_MATCH0_REG 0x34
+#define TOY_MATCH1_REG 0x38
+#define TOY_MATCH2_REG 0x3c
+#define RTC_CTRL_REG   0x40
+#define RTC_TRIM_REG   0x60
+#define RTC_WRITE0_REG 0x64
+#define RTC_READ0_REG  0x68
+#define RTC_MATCH0_REG 0x6c
+#define RTC_MATCH1_REG 0x70
+#define RTC_MATCH2_REG 0x74
+
+#define TOY_MON        GENMASK(31, 26)
+#define TOY_DAY        GENMASK(25, 21)
+#define TOY_HOUR       GENMASK(20, 16)
+#define TOY_MIN        GENMASK(15, 10)
+#define TOY_SEC        GENMASK(9, 4)
+#define TOY_MSEC       GENMASK(3, 0)
+
+struct ls2x_rtc_priv {
+	struct regmap *regmap;
+};
+
+static const struct regmap_config ls2x_rtc_regmap_config = {
+	.reg_bits = 32,
+	.val_bits = 32,
+	.reg_stride = 4,
+};
+
+struct ls2x_rtc_regs {
+	u32 reg0;
+	u32 reg1;
+};
+
+static inline void ls2x_rtc_regs_to_time(struct ls2x_rtc_regs *regs,
+					 struct rtc_time *tm)
+{
+	tm->tm_year = regs->reg1;
+	tm->tm_sec = FIELD_GET(TOY_SEC, regs->reg0);
+	tm->tm_min = FIELD_GET(TOY_MIN, regs->reg0);
+	tm->tm_hour = FIELD_GET(TOY_HOUR, regs->reg0);
+	tm->tm_mday = FIELD_GET(TOY_DAY, regs->reg0);
+	tm->tm_mon = FIELD_GET(TOY_MON, regs->reg0) - 1;
+}
+
+static inline void ls2x_rtc_time_to_regs(struct rtc_time *tm,
+					 struct ls2x_rtc_regs *regs)
+{
+	regs->reg0 = FIELD_PREP(TOY_SEC, tm->tm_sec);
+	regs->reg0 |= FIELD_PREP(TOY_MIN, tm->tm_min);
+	regs->reg0 |= FIELD_PREP(TOY_HOUR, tm->tm_hour);
+	regs->reg0 |= FIELD_PREP(TOY_DAY, tm->tm_mday);
+	regs->reg0 |= FIELD_PREP(TOY_MON, tm->tm_mon + 1);
+	regs->reg1 = tm->tm_year;
+}
+
+static int ls2x_rtc_read_time(struct device *dev, struct rtc_time *tm)
+{
+	struct ls2x_rtc_priv *priv = dev_get_drvdata(dev);
+	struct ls2x_rtc_regs regs;
+	int ret;
+
+	ret = regmap_read(priv->regmap, TOY_READ1_REG, &regs.reg1);
+	if (unlikely(ret))
+		return ret;
+
+	ret = regmap_read(priv->regmap, TOY_READ0_REG, &regs.reg0);
+	if (unlikely(ret))
+		return ret;
+
+	ls2x_rtc_regs_to_time(&regs, tm);
+
+	return 0;
+}
+
+static int ls2x_rtc_set_time(struct device *dev, struct rtc_time *tm)
+{
+	struct ls2x_rtc_priv *priv = dev_get_drvdata(dev);
+	struct ls2x_rtc_regs regs;
+	int ret;
+
+	ls2x_rtc_time_to_regs(tm, &regs);
+
+	ret = regmap_write(priv->regmap, TOY_WRITE0_REG, regs.reg0);
+	if (unlikely(ret))
+		return ret;
+
+	return regmap_write(priv->regmap, TOY_WRITE1_REG, regs.reg1);
+}
+
+static struct rtc_class_ops ls2x_rtc_ops = {
+	.read_time = ls2x_rtc_read_time,
+	.set_time = ls2x_rtc_set_time,
+};
+
+static int ls2x_rtc_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct rtc_device *rtc;
+	struct ls2x_rtc_priv *priv;
+	void __iomem *regs;
+
+	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
+	if (unlikely(!priv))
+		return -ENOMEM;
+
+	platform_set_drvdata(pdev, priv);
+
+	regs = devm_platform_ioremap_resource(pdev, 0);
+	if (IS_ERR(regs))
+		return PTR_ERR(regs);
+
+	priv->regmap = devm_regmap_init_mmio(dev, regs,
+					     &ls2x_rtc_regmap_config);
+	if (IS_ERR(priv->regmap))
+		return PTR_ERR(priv->regmap);
+
+	rtc = devm_rtc_allocate_device(dev);
+	if (IS_ERR(rtc))
+		return PTR_ERR(rtc);
+
+	rtc->ops = &ls2x_rtc_ops;
+
+	/* Due to hardware erratum, all years multiple of 4 are considered
+	 * leap year, so only years 2000 through 2099 are usable.
+	 *
+	 * Previous out-of-tree versions of this driver wrote tm_year directly
+	 * into the year register, so epoch 2000 must be used to preserve
+	 * semantics on shipped systems.
+	 */
+	rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
+	rtc->range_max = RTC_TIMESTAMP_END_2099;
+
+	return devm_rtc_register_device(rtc);
+}
+
+static const struct of_device_id ls2x_rtc_of_match[] = {
+	{ .compatible = "loongson,ls2x-rtc" },
+	{ /* sentinel */ },
+};
+MODULE_DEVICE_TABLE(of, ls2x_rtc_of_match);
+
+static struct platform_driver ls2x_rtc_driver = {
+	.probe		= ls2x_rtc_probe,
+	.driver		= {
+		.name	= "ls2x-rtc",
+		.of_match_table = ls2x_rtc_of_match,
+	},
+};
+
+module_platform_driver(ls2x_rtc_driver);
+
+MODULE_DESCRIPTION("LS2X RTC driver");
+MODULE_AUTHOR("WANG Xuerui");
+MODULE_AUTHOR("Huacai Chen");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:ls2x-rtc");
-- 
2.33.0


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

* [PATCH RESEND v5 2/6] dt-bindings: rtc: Add bindings for LS2X RTC
  2021-08-23 16:31 [PATCH RESEND v5 0/6] rtc: ls2x: Add support for the Loongson-2K/LS7A RTC WANG Xuerui
  2021-08-23 16:31 ` [PATCH RESEND v5 1/6] " WANG Xuerui
@ 2021-08-23 16:31 ` WANG Xuerui
  2021-08-23 16:31 ` [PATCH RESEND v5 3/6] MIPS: Loongson64: DTS: Add RTC support to LS7A WANG Xuerui
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: WANG Xuerui @ 2021-08-23 16:31 UTC (permalink / raw)
  To: linux-rtc
  Cc: WANG Xuerui, Rob Herring, Rob Herring, Huacai Chen, devicetree,
	linux-mips

Document the binding for the LS2X RTC block found on the Loongson-2K SoC
and the LS7A bridge, originally appearing on the Loongson-2H.

Signed-off-by: WANG Xuerui <git@xen0n.name>
Acked-by: Rob Herring <robh@kernel.org>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Huacai Chen <chenhuacai@kernel.org>
Cc: devicetree@vger.kernel.org
Cc: linux-mips@vger.kernel.org
---
 Documentation/devicetree/bindings/rtc/trivial-rtc.yaml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/rtc/trivial-rtc.yaml b/Documentation/devicetree/bindings/rtc/trivial-rtc.yaml
index 13925bb78ec7..64f7e81e7043 100644
--- a/Documentation/devicetree/bindings/rtc/trivial-rtc.yaml
+++ b/Documentation/devicetree/bindings/rtc/trivial-rtc.yaml
@@ -45,6 +45,8 @@ properties:
       - isil,isl1218
       # Intersil ISL12022 Real-time Clock
       - isil,isl12022
+      # Loongson LS2X RTC
+      - loongson,ls2x-rtc
       # Real Time Clock Module with I2C-Bus
       - microcrystal,rv3028
       # Real Time Clock Module with I2C-Bus
-- 
2.33.0


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

* [PATCH RESEND v5 3/6] MIPS: Loongson64: DTS: Add RTC support to LS7A
  2021-08-23 16:31 [PATCH RESEND v5 0/6] rtc: ls2x: Add support for the Loongson-2K/LS7A RTC WANG Xuerui
  2021-08-23 16:31 ` [PATCH RESEND v5 1/6] " WANG Xuerui
  2021-08-23 16:31 ` [PATCH RESEND v5 2/6] dt-bindings: rtc: Add bindings for LS2X RTC WANG Xuerui
@ 2021-08-23 16:31 ` WANG Xuerui
  2021-08-23 16:31 ` [PATCH RESEND v5 4/6] MIPS: Loongson: Enable LS2X RTC in loongson3_defconfig WANG Xuerui
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: WANG Xuerui @ 2021-08-23 16:31 UTC (permalink / raw)
  To: linux-rtc
  Cc: WANG Xuerui, Jiaxun Yang, Rob Herring, Thomas Bogendoerfer,
	Qing Zhang, Tiezhu Yang, zhaoxiao, devicetree, linux-mips

The LS7A RTC module is now supported, enable it.

Signed-off-by: WANG Xuerui <git@xen0n.name>
Acked-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Qing Zhang <zhangqing@loongson.cn>
Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
Cc: zhaoxiao <zhaoxiao@uniontech.com>
Cc: devicetree@vger.kernel.org
Cc: linux-mips@vger.kernel.org
---
 arch/mips/boot/dts/loongson/ls7a-pch.dtsi | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/mips/boot/dts/loongson/ls7a-pch.dtsi b/arch/mips/boot/dts/loongson/ls7a-pch.dtsi
index 2f45fce2cdc4..82035de4774f 100644
--- a/arch/mips/boot/dts/loongson/ls7a-pch.dtsi
+++ b/arch/mips/boot/dts/loongson/ls7a-pch.dtsi
@@ -19,6 +19,11 @@ pic: interrupt-controller@10000000 {
 			#interrupt-cells = <2>;
 		};
 
+		rtc0: rtc@100d0100 {
+			compatible = "loongson,ls2x-rtc";
+			reg = <0 0x100d0100 0 0x78>;
+		};
+
 		ls7a_uart0: serial@10080000 {
 			compatible = "ns16550a";
 			reg = <0 0x10080000 0 0x100>;
-- 
2.33.0


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

* [PATCH RESEND v5 4/6] MIPS: Loongson: Enable LS2X RTC in loongson3_defconfig
  2021-08-23 16:31 [PATCH RESEND v5 0/6] rtc: ls2x: Add support for the Loongson-2K/LS7A RTC WANG Xuerui
                   ` (2 preceding siblings ...)
  2021-08-23 16:31 ` [PATCH RESEND v5 3/6] MIPS: Loongson64: DTS: Add RTC support to LS7A WANG Xuerui
@ 2021-08-23 16:31 ` WANG Xuerui
  2021-08-23 16:31 ` [PATCH RESEND v5 5/6] MIPS: Loongson64: DTS: Add RTC support to Loongson-2K WANG Xuerui
  2021-08-23 16:31 ` [PATCH RESEND v5 6/6] MIPS: Loongson: Enable LS2X RTC in loongson2k_defconfig WANG Xuerui
  5 siblings, 0 replies; 10+ messages in thread
From: WANG Xuerui @ 2021-08-23 16:31 UTC (permalink / raw)
  To: linux-rtc
  Cc: WANG Xuerui, Thomas Bogendoerfer, Huacai Chen, Tiezhu Yang,
	Youling Tang, Qing Zhang, linux-mips

This is now supported, enable for Loongson-3 systems.
Other systems are unaffected.

Signed-off-by: WANG Xuerui <git@xen0n.name>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Huacai Chen <chenhuacai@kernel.org>
Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
Cc: Youling Tang <tangyouling@loongson.cn>
Cc: Qing Zhang <zhangqing@loongson.cn>
Cc: linux-mips@vger.kernel.org
---
 arch/mips/configs/loongson3_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/mips/configs/loongson3_defconfig b/arch/mips/configs/loongson3_defconfig
index f02101ff04b3..fccb6906d4b4 100644
--- a/arch/mips/configs/loongson3_defconfig
+++ b/arch/mips/configs/loongson3_defconfig
@@ -320,6 +320,7 @@ CONFIG_USB_SERIAL_OPTION=m
 CONFIG_RTC_CLASS=y
 CONFIG_RTC_DRV_CMOS=y
 CONFIG_RTC_DRV_GOLDFISH=y
+CONFIG_RTC_DRV_LS2X=y
 CONFIG_DMADEVICES=y
 CONFIG_VIRTIO_PCI=y
 CONFIG_VIRTIO_BALLOON=m
-- 
2.33.0


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

* [PATCH RESEND v5 5/6] MIPS: Loongson64: DTS: Add RTC support to Loongson-2K
  2021-08-23 16:31 [PATCH RESEND v5 0/6] rtc: ls2x: Add support for the Loongson-2K/LS7A RTC WANG Xuerui
                   ` (3 preceding siblings ...)
  2021-08-23 16:31 ` [PATCH RESEND v5 4/6] MIPS: Loongson: Enable LS2X RTC in loongson3_defconfig WANG Xuerui
@ 2021-08-23 16:31 ` WANG Xuerui
  2021-08-23 16:31 ` [PATCH RESEND v5 6/6] MIPS: Loongson: Enable LS2X RTC in loongson2k_defconfig WANG Xuerui
  5 siblings, 0 replies; 10+ messages in thread
From: WANG Xuerui @ 2021-08-23 16:31 UTC (permalink / raw)
  To: linux-rtc
  Cc: WANG Xuerui, Jiaxun Yang, Rob Herring, Thomas Bogendoerfer,
	Huacai Chen, Qing Zhang, Tiezhu Yang, zhaoxiao, devicetree,
	linux-mips

The Loongson-2K RTC module is now supported, enable it.

The MMIO address is unclear from the Loongson 2K1000 user manual, I took
it from Loongson's out-of-tree fork of Linux 4.19.

Signed-off-by: WANG Xuerui <git@xen0n.name>
Tested-by: Jiaxun Yang <jiaxun.yang@flygoat.com> # loongson2k
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Huacai Chen <chenhuacai@kernel.org>
Cc: Qing Zhang <zhangqing@loongson.cn>
Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
Cc: zhaoxiao <zhaoxiao@uniontech.com>
Cc: devicetree@vger.kernel.org
Cc: linux-mips@vger.kernel.org
---
 arch/mips/boot/dts/loongson/loongson64-2k1000.dtsi | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/mips/boot/dts/loongson/loongson64-2k1000.dtsi b/arch/mips/boot/dts/loongson/loongson64-2k1000.dtsi
index bfc3d3243ee7..4a04e1dc5fda 100644
--- a/arch/mips/boot/dts/loongson/loongson64-2k1000.dtsi
+++ b/arch/mips/boot/dts/loongson/loongson64-2k1000.dtsi
@@ -52,6 +52,11 @@ package0: bus@10000000 {
 			0 0x40000000 0 0x40000000 0 0x40000000
 			0xfe 0x00000000 0xfe 0x00000000 0 0x40000000>;
 
+		rtc0: rtc@1fe07800 {
+			compatible = "loongson,ls2x-rtc";
+			reg = <0 0x1fe07800 0 0x78>;
+		};
+
 		liointc0: interrupt-controller@1fe11400 {
 			compatible = "loongson,liointc-2.0";
 			reg = <0 0x1fe11400 0 0x40>,
-- 
2.33.0


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

* [PATCH RESEND v5 6/6] MIPS: Loongson: Enable LS2X RTC in loongson2k_defconfig
  2021-08-23 16:31 [PATCH RESEND v5 0/6] rtc: ls2x: Add support for the Loongson-2K/LS7A RTC WANG Xuerui
                   ` (4 preceding siblings ...)
  2021-08-23 16:31 ` [PATCH RESEND v5 5/6] MIPS: Loongson64: DTS: Add RTC support to Loongson-2K WANG Xuerui
@ 2021-08-23 16:31 ` WANG Xuerui
  5 siblings, 0 replies; 10+ messages in thread
From: WANG Xuerui @ 2021-08-23 16:31 UTC (permalink / raw)
  To: linux-rtc
  Cc: WANG Xuerui, Jiaxun Yang, Huacai Chen, Tiezhu Yang, Qing Zhang,
	linux-mips

This is now supported, enable for Loongson-2K systems.
Other systems are unaffected.

Signed-off-by: WANG Xuerui <git@xen0n.name>
Tested-by: Jiaxun Yang <jiaxun.yang@flygoat.com> # loongson2k
Cc: Huacai Chen <chenhuacai@kernel.org>
Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
Cc: Qing Zhang <zhangqing@loongson.cn>
Cc: linux-mips@vger.kernel.org
---
 arch/mips/configs/loongson2k_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/mips/configs/loongson2k_defconfig b/arch/mips/configs/loongson2k_defconfig
index e948ca487e2d..e15f34857956 100644
--- a/arch/mips/configs/loongson2k_defconfig
+++ b/arch/mips/configs/loongson2k_defconfig
@@ -280,6 +280,7 @@ CONFIG_USB_SERIAL=m
 CONFIG_USB_SERIAL_OPTION=m
 CONFIG_RTC_CLASS=y
 CONFIG_RTC_DRV_CMOS=y
+CONFIG_RTC_DRV_LS2X=y
 CONFIG_DMADEVICES=y
 # CONFIG_CPU_HWMON is not set
 CONFIG_PM_DEVFREQ=y
-- 
2.33.0


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

* Re: [PATCH RESEND v5 1/6] rtc: ls2x: Add support for the Loongson-2K/LS7A RTC
  2021-08-23 16:31 ` [PATCH RESEND v5 1/6] " WANG Xuerui
@ 2021-08-31  0:33   ` Nobuhiro Iwamatsu
  2021-09-25 22:14   ` Alexandre Belloni
  2021-09-27 11:16   ` Alexandre Belloni
  2 siblings, 0 replies; 10+ messages in thread
From: Nobuhiro Iwamatsu @ 2021-08-31  0:33 UTC (permalink / raw)
  To: WANG Xuerui
  Cc: linux-rtc, Huacai Chen, Jiaxun Yang, Alexandre Belloni,
	devicetree, linux-mips

Hello,

2021年8月24日(火) 1:39 WANG Xuerui <git@xen0n.name>:
>
> This RTC module is integrated into the Loongson-2K SoC and the LS7A
> bridge chip. This version is almost entirely rewritten to make use of
> current kernel API.
>
> Signed-off-by: Huacai Chen <chenhuacai@kernel.org>
> Signed-off-by: WANG Xuerui <git@xen0n.name>
> Tested-by: Jiaxun Yang <jiaxun.yang@flygoat.com> # loongson2k
> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
> Cc: devicetree@vger.kernel.org
> Cc: linux-mips@vger.kernel.org
> ---
>  drivers/rtc/Kconfig    |  11 +++
>  drivers/rtc/Makefile   |   1 +
>  drivers/rtc/rtc-ls2x.c | 180 +++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 192 insertions(+)
>  create mode 100644 drivers/rtc/rtc-ls2x.c

Reviewed-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>

Best regards,
  Nobuhiro

>
> diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
> index daff06707455..819f366b4d91 100644
> --- a/drivers/rtc/Kconfig
> +++ b/drivers/rtc/Kconfig
> @@ -1313,6 +1313,17 @@ config RTC_DRV_NTXEC
>           embedded controller found in certain e-book readers designed by the
>           original design manufacturer Netronix.
>
> +config RTC_DRV_LS2X
> +       tristate "Loongson LS2X RTC"
> +       depends on OF && MACH_LOONGSON64 || COMPILE_TEST
> +       select REGMAP_MMIO
> +       help
> +         If you say yes here you get support for the RTC on the Loongson-2K
> +         SoC and LS7A bridge, which first appeared on the Loongson-2H.
> +
> +         This driver can also be built as a module. If so, the module
> +         will be called rtc-ls2x.
> +
>  comment "on-CPU RTC drivers"
>
>  config RTC_DRV_ASM9260
> diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
> index 5ceeafe4d5b2..98e68484f519 100644
> --- a/drivers/rtc/Makefile
> +++ b/drivers/rtc/Makefile
> @@ -83,6 +83,7 @@ obj-$(CONFIG_RTC_DRV_LOONGSON1)       += rtc-ls1x.o
>  obj-$(CONFIG_RTC_DRV_LP8788)   += rtc-lp8788.o
>  obj-$(CONFIG_RTC_DRV_LPC24XX)  += rtc-lpc24xx.o
>  obj-$(CONFIG_RTC_DRV_LPC32XX)  += rtc-lpc32xx.o
> +obj-$(CONFIG_RTC_DRV_LS2X)     += rtc-ls2x.o
>  obj-$(CONFIG_RTC_DRV_M41T80)   += rtc-m41t80.o
>  obj-$(CONFIG_RTC_DRV_M41T93)   += rtc-m41t93.o
>  obj-$(CONFIG_RTC_DRV_M41T94)   += rtc-m41t94.o
> diff --git a/drivers/rtc/rtc-ls2x.c b/drivers/rtc/rtc-ls2x.c
> new file mode 100644
> index 000000000000..58901323b219
> --- /dev/null
> +++ b/drivers/rtc/rtc-ls2x.c
> @@ -0,0 +1,180 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Loongson-2K/7A RTC driver
> + *
> + * Based on the original out-of-tree Loongson-2H RTC driver for Linux 2.6.32,
> + * by Shaozong Liu <liushaozong@loongson.cn>.
> + *
> + * Maintained out-of-tree by Huacai Chen <chenhuacai@kernel.org>.
> + *
> + * Rewritten for mainline by WANG Xuerui <git@xen0n.name>.
> + */
> +
> +#include <linux/bitfield.h>
> +#include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/platform_device.h>
> +#include <linux/regmap.h>
> +#include <linux/rtc.h>
> +
> +#define TOY_TRIM_REG   0x20
> +#define TOY_WRITE0_REG 0x24
> +#define TOY_WRITE1_REG 0x28
> +#define TOY_READ0_REG  0x2c
> +#define TOY_READ1_REG  0x30
> +#define TOY_MATCH0_REG 0x34
> +#define TOY_MATCH1_REG 0x38
> +#define TOY_MATCH2_REG 0x3c
> +#define RTC_CTRL_REG   0x40
> +#define RTC_TRIM_REG   0x60
> +#define RTC_WRITE0_REG 0x64
> +#define RTC_READ0_REG  0x68
> +#define RTC_MATCH0_REG 0x6c
> +#define RTC_MATCH1_REG 0x70
> +#define RTC_MATCH2_REG 0x74
> +
> +#define TOY_MON        GENMASK(31, 26)
> +#define TOY_DAY        GENMASK(25, 21)
> +#define TOY_HOUR       GENMASK(20, 16)
> +#define TOY_MIN        GENMASK(15, 10)
> +#define TOY_SEC        GENMASK(9, 4)
> +#define TOY_MSEC       GENMASK(3, 0)
> +
> +struct ls2x_rtc_priv {
> +       struct regmap *regmap;
> +};
> +
> +static const struct regmap_config ls2x_rtc_regmap_config = {
> +       .reg_bits = 32,
> +       .val_bits = 32,
> +       .reg_stride = 4,
> +};
> +
> +struct ls2x_rtc_regs {
> +       u32 reg0;
> +       u32 reg1;
> +};
> +
> +static inline void ls2x_rtc_regs_to_time(struct ls2x_rtc_regs *regs,
> +                                        struct rtc_time *tm)
> +{
> +       tm->tm_year = regs->reg1;
> +       tm->tm_sec = FIELD_GET(TOY_SEC, regs->reg0);
> +       tm->tm_min = FIELD_GET(TOY_MIN, regs->reg0);
> +       tm->tm_hour = FIELD_GET(TOY_HOUR, regs->reg0);
> +       tm->tm_mday = FIELD_GET(TOY_DAY, regs->reg0);
> +       tm->tm_mon = FIELD_GET(TOY_MON, regs->reg0) - 1;
> +}
> +
> +static inline void ls2x_rtc_time_to_regs(struct rtc_time *tm,
> +                                        struct ls2x_rtc_regs *regs)
> +{
> +       regs->reg0 = FIELD_PREP(TOY_SEC, tm->tm_sec);
> +       regs->reg0 |= FIELD_PREP(TOY_MIN, tm->tm_min);
> +       regs->reg0 |= FIELD_PREP(TOY_HOUR, tm->tm_hour);
> +       regs->reg0 |= FIELD_PREP(TOY_DAY, tm->tm_mday);
> +       regs->reg0 |= FIELD_PREP(TOY_MON, tm->tm_mon + 1);
> +       regs->reg1 = tm->tm_year;
> +}
> +
> +static int ls2x_rtc_read_time(struct device *dev, struct rtc_time *tm)
> +{
> +       struct ls2x_rtc_priv *priv = dev_get_drvdata(dev);
> +       struct ls2x_rtc_regs regs;
> +       int ret;
> +
> +       ret = regmap_read(priv->regmap, TOY_READ1_REG, &regs.reg1);
> +       if (unlikely(ret))
> +               return ret;
> +
> +       ret = regmap_read(priv->regmap, TOY_READ0_REG, &regs.reg0);
> +       if (unlikely(ret))
> +               return ret;
> +
> +       ls2x_rtc_regs_to_time(&regs, tm);
> +
> +       return 0;
> +}
> +
> +static int ls2x_rtc_set_time(struct device *dev, struct rtc_time *tm)
> +{
> +       struct ls2x_rtc_priv *priv = dev_get_drvdata(dev);
> +       struct ls2x_rtc_regs regs;
> +       int ret;
> +
> +       ls2x_rtc_time_to_regs(tm, &regs);
> +
> +       ret = regmap_write(priv->regmap, TOY_WRITE0_REG, regs.reg0);
> +       if (unlikely(ret))
> +               return ret;
> +
> +       return regmap_write(priv->regmap, TOY_WRITE1_REG, regs.reg1);
> +}
> +
> +static struct rtc_class_ops ls2x_rtc_ops = {
> +       .read_time = ls2x_rtc_read_time,
> +       .set_time = ls2x_rtc_set_time,
> +};
> +
> +static int ls2x_rtc_probe(struct platform_device *pdev)
> +{
> +       struct device *dev = &pdev->dev;
> +       struct rtc_device *rtc;
> +       struct ls2x_rtc_priv *priv;
> +       void __iomem *regs;
> +
> +       priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
> +       if (unlikely(!priv))
> +               return -ENOMEM;
> +
> +       platform_set_drvdata(pdev, priv);
> +
> +       regs = devm_platform_ioremap_resource(pdev, 0);
> +       if (IS_ERR(regs))
> +               return PTR_ERR(regs);
> +
> +       priv->regmap = devm_regmap_init_mmio(dev, regs,
> +                                            &ls2x_rtc_regmap_config);
> +       if (IS_ERR(priv->regmap))
> +               return PTR_ERR(priv->regmap);
> +
> +       rtc = devm_rtc_allocate_device(dev);
> +       if (IS_ERR(rtc))
> +               return PTR_ERR(rtc);
> +
> +       rtc->ops = &ls2x_rtc_ops;
> +
> +       /* Due to hardware erratum, all years multiple of 4 are considered
> +        * leap year, so only years 2000 through 2099 are usable.
> +        *
> +        * Previous out-of-tree versions of this driver wrote tm_year directly
> +        * into the year register, so epoch 2000 must be used to preserve
> +        * semantics on shipped systems.
> +        */
> +       rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
> +       rtc->range_max = RTC_TIMESTAMP_END_2099;
> +
> +       return devm_rtc_register_device(rtc);
> +}
> +
> +static const struct of_device_id ls2x_rtc_of_match[] = {
> +       { .compatible = "loongson,ls2x-rtc" },
> +       { /* sentinel */ },
> +};
> +MODULE_DEVICE_TABLE(of, ls2x_rtc_of_match);
> +
> +static struct platform_driver ls2x_rtc_driver = {
> +       .probe          = ls2x_rtc_probe,
> +       .driver         = {
> +               .name   = "ls2x-rtc",
> +               .of_match_table = ls2x_rtc_of_match,
> +       },
> +};
> +
> +module_platform_driver(ls2x_rtc_driver);
> +
> +MODULE_DESCRIPTION("LS2X RTC driver");
> +MODULE_AUTHOR("WANG Xuerui");
> +MODULE_AUTHOR("Huacai Chen");
> +MODULE_LICENSE("GPL");
> +MODULE_ALIAS("platform:ls2x-rtc");
> --
> 2.33.0
>


-- 
Nobuhiro Iwamatsu
   iwamatsu at {nigauri.org / debian.org}
   GPG ID: 40AD1FA6

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

* Re: [PATCH RESEND v5 1/6] rtc: ls2x: Add support for the Loongson-2K/LS7A RTC
  2021-08-23 16:31 ` [PATCH RESEND v5 1/6] " WANG Xuerui
  2021-08-31  0:33   ` Nobuhiro Iwamatsu
@ 2021-09-25 22:14   ` Alexandre Belloni
  2021-09-27 11:16   ` Alexandre Belloni
  2 siblings, 0 replies; 10+ messages in thread
From: Alexandre Belloni @ 2021-09-25 22:14 UTC (permalink / raw)
  To: WANG Xuerui; +Cc: linux-rtc, Huacai Chen, Jiaxun Yang, devicetree, linux-mips

Hello,

On 24/08/2021 00:31:37+0800, WANG Xuerui wrote:
> This RTC module is integrated into the Loongson-2K SoC and the LS7A
> bridge chip. This version is almost entirely rewritten to make use of
> current kernel API.
> 
> Signed-off-by: Huacai Chen <chenhuacai@kernel.org>
> Signed-off-by: WANG Xuerui <git@xen0n.name>
> Tested-by: Jiaxun Yang <jiaxun.yang@flygoat.com> # loongson2k
> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
> Cc: devicetree@vger.kernel.org
> Cc: linux-mips@vger.kernel.org
> ---
>  drivers/rtc/Kconfig    |  11 +++
>  drivers/rtc/Makefile   |   1 +
>  drivers/rtc/rtc-ls2x.c | 180 +++++++++++++++++++++++++++++++++++++++++

Note that I'm still concerned this duplicates rtc-ls1x.c

>  3 files changed, 192 insertions(+)
>  create mode 100644 drivers/rtc/rtc-ls2x.c
> 
> diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
> index daff06707455..819f366b4d91 100644
> --- a/drivers/rtc/Kconfig
> +++ b/drivers/rtc/Kconfig
> @@ -1313,6 +1313,17 @@ config RTC_DRV_NTXEC
>  	  embedded controller found in certain e-book readers designed by the
>  	  original design manufacturer Netronix.
>  
> +config RTC_DRV_LS2X
> +	tristate "Loongson LS2X RTC"
> +	depends on OF && MACH_LOONGSON64 || COMPILE_TEST
> +	select REGMAP_MMIO
> +	help
> +	  If you say yes here you get support for the RTC on the Loongson-2K
> +	  SoC and LS7A bridge, which first appeared on the Loongson-2H.
> +
> +	  This driver can also be built as a module. If so, the module
> +	  will be called rtc-ls2x.
> +
>  comment "on-CPU RTC drivers"
>  
>  config RTC_DRV_ASM9260
> diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
> index 5ceeafe4d5b2..98e68484f519 100644
> --- a/drivers/rtc/Makefile
> +++ b/drivers/rtc/Makefile
> @@ -83,6 +83,7 @@ obj-$(CONFIG_RTC_DRV_LOONGSON1)	+= rtc-ls1x.o
>  obj-$(CONFIG_RTC_DRV_LP8788)	+= rtc-lp8788.o
>  obj-$(CONFIG_RTC_DRV_LPC24XX)	+= rtc-lpc24xx.o
>  obj-$(CONFIG_RTC_DRV_LPC32XX)	+= rtc-lpc32xx.o
> +obj-$(CONFIG_RTC_DRV_LS2X)	+= rtc-ls2x.o
>  obj-$(CONFIG_RTC_DRV_M41T80)	+= rtc-m41t80.o
>  obj-$(CONFIG_RTC_DRV_M41T93)	+= rtc-m41t93.o
>  obj-$(CONFIG_RTC_DRV_M41T94)	+= rtc-m41t94.o
> diff --git a/drivers/rtc/rtc-ls2x.c b/drivers/rtc/rtc-ls2x.c
> new file mode 100644
> index 000000000000..58901323b219
> --- /dev/null
> +++ b/drivers/rtc/rtc-ls2x.c
> @@ -0,0 +1,180 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Loongson-2K/7A RTC driver
> + *
> + * Based on the original out-of-tree Loongson-2H RTC driver for Linux 2.6.32,
> + * by Shaozong Liu <liushaozong@loongson.cn>.
> + *
> + * Maintained out-of-tree by Huacai Chen <chenhuacai@kernel.org>.
> + *
> + * Rewritten for mainline by WANG Xuerui <git@xen0n.name>.
> + */
> +
> +#include <linux/bitfield.h>
> +#include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/platform_device.h>
> +#include <linux/regmap.h>
> +#include <linux/rtc.h>
> +
> +#define TOY_TRIM_REG   0x20
> +#define TOY_WRITE0_REG 0x24
> +#define TOY_WRITE1_REG 0x28
> +#define TOY_READ0_REG  0x2c
> +#define TOY_READ1_REG  0x30
> +#define TOY_MATCH0_REG 0x34
> +#define TOY_MATCH1_REG 0x38
> +#define TOY_MATCH2_REG 0x3c
> +#define RTC_CTRL_REG   0x40
> +#define RTC_TRIM_REG   0x60
> +#define RTC_WRITE0_REG 0x64
> +#define RTC_READ0_REG  0x68
> +#define RTC_MATCH0_REG 0x6c
> +#define RTC_MATCH1_REG 0x70
> +#define RTC_MATCH2_REG 0x74
> +
> +#define TOY_MON        GENMASK(31, 26)
> +#define TOY_DAY        GENMASK(25, 21)
> +#define TOY_HOUR       GENMASK(20, 16)
> +#define TOY_MIN        GENMASK(15, 10)
> +#define TOY_SEC        GENMASK(9, 4)
> +#define TOY_MSEC       GENMASK(3, 0)
> +
> +struct ls2x_rtc_priv {
> +	struct regmap *regmap;
> +};
> +
> +static const struct regmap_config ls2x_rtc_regmap_config = {
> +	.reg_bits = 32,
> +	.val_bits = 32,
> +	.reg_stride = 4,
> +};
> +
> +struct ls2x_rtc_regs {
> +	u32 reg0;
> +	u32 reg1;
> +};
> +
> +static inline void ls2x_rtc_regs_to_time(struct ls2x_rtc_regs *regs,
> +					 struct rtc_time *tm)
> +{
> +	tm->tm_year = regs->reg1;
> +	tm->tm_sec = FIELD_GET(TOY_SEC, regs->reg0);
> +	tm->tm_min = FIELD_GET(TOY_MIN, regs->reg0);
> +	tm->tm_hour = FIELD_GET(TOY_HOUR, regs->reg0);
> +	tm->tm_mday = FIELD_GET(TOY_DAY, regs->reg0);
> +	tm->tm_mon = FIELD_GET(TOY_MON, regs->reg0) - 1;
> +}
> +
> +static inline void ls2x_rtc_time_to_regs(struct rtc_time *tm,
> +					 struct ls2x_rtc_regs *regs)
> +{
> +	regs->reg0 = FIELD_PREP(TOY_SEC, tm->tm_sec);
> +	regs->reg0 |= FIELD_PREP(TOY_MIN, tm->tm_min);
> +	regs->reg0 |= FIELD_PREP(TOY_HOUR, tm->tm_hour);
> +	regs->reg0 |= FIELD_PREP(TOY_DAY, tm->tm_mday);
> +	regs->reg0 |= FIELD_PREP(TOY_MON, tm->tm_mon + 1);
> +	regs->reg1 = tm->tm_year;
> +}
> +
> +static int ls2x_rtc_read_time(struct device *dev, struct rtc_time *tm)
> +{
> +	struct ls2x_rtc_priv *priv = dev_get_drvdata(dev);
> +	struct ls2x_rtc_regs regs;
> +	int ret;
> +
> +	ret = regmap_read(priv->regmap, TOY_READ1_REG, &regs.reg1);
> +	if (unlikely(ret))
> +		return ret;
> +
> +	ret = regmap_read(priv->regmap, TOY_READ0_REG, &regs.reg0);
> +	if (unlikely(ret))
> +		return ret;
> +

I'm actually wondering why you read first TOY_READ1_REG then
TOY_READ0_REG. ls1x does the opposite and the ls1c datasheet I found
doesn't mention any latching happening. So unless latching is done on
TOY_READ1_REG, you could use regmap_bulk_read and simply avoid struct
ls2x_rtc_regs.
If there is no latching, you may need to read TOY_READ0_REG at least
twice. Because TOY_READ1_REG only contains the year, it is an issue only
on 31 of December and it will not be easy to reproduce.


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

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

* Re: [PATCH RESEND v5 1/6] rtc: ls2x: Add support for the Loongson-2K/LS7A RTC
  2021-08-23 16:31 ` [PATCH RESEND v5 1/6] " WANG Xuerui
  2021-08-31  0:33   ` Nobuhiro Iwamatsu
  2021-09-25 22:14   ` Alexandre Belloni
@ 2021-09-27 11:16   ` Alexandre Belloni
  2 siblings, 0 replies; 10+ messages in thread
From: Alexandre Belloni @ 2021-09-27 11:16 UTC (permalink / raw)
  To: WANG Xuerui; +Cc: linux-rtc, Huacai Chen, Jiaxun Yang, devicetree, linux-mips

On 24/08/2021 00:31:37+0800, WANG Xuerui wrote:
> +
> +static struct rtc_class_ops ls2x_rtc_ops = {

I forgot to add that this should be const

> +	.read_time = ls2x_rtc_read_time,
> +	.set_time = ls2x_rtc_set_time,
> +};
> +

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

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

end of thread, other threads:[~2021-09-27 11:16 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-23 16:31 [PATCH RESEND v5 0/6] rtc: ls2x: Add support for the Loongson-2K/LS7A RTC WANG Xuerui
2021-08-23 16:31 ` [PATCH RESEND v5 1/6] " WANG Xuerui
2021-08-31  0:33   ` Nobuhiro Iwamatsu
2021-09-25 22:14   ` Alexandre Belloni
2021-09-27 11:16   ` Alexandre Belloni
2021-08-23 16:31 ` [PATCH RESEND v5 2/6] dt-bindings: rtc: Add bindings for LS2X RTC WANG Xuerui
2021-08-23 16:31 ` [PATCH RESEND v5 3/6] MIPS: Loongson64: DTS: Add RTC support to LS7A WANG Xuerui
2021-08-23 16:31 ` [PATCH RESEND v5 4/6] MIPS: Loongson: Enable LS2X RTC in loongson3_defconfig WANG Xuerui
2021-08-23 16:31 ` [PATCH RESEND v5 5/6] MIPS: Loongson64: DTS: Add RTC support to Loongson-2K WANG Xuerui
2021-08-23 16:31 ` [PATCH RESEND v5 6/6] MIPS: Loongson: Enable LS2X RTC in loongson2k_defconfig WANG Xuerui

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).