* [PATCH v4 0/3] rtc: cv1800b: Use the RTC node for time and system reset
@ 2026-10-08 11:30 Zhuxu Ran
2026-10-08 11:30 ` [PATCH v4 1/3] rtc: cv1800b: Add seconds counter support Zhuxu Ran
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Zhuxu Ran @ 2026-10-08 11:30 UTC (permalink / raw)
To: u-boot
Cc: Yao Zi, Tom Rini, Johan Jonker, Alexander Koch, Kongyang Liu,
Hiago De Franco, Thomas Bonnefille, Quentin Schulz,
Peter Robinson, Leo Yu-Chi Liang, Casey Connolly,
Varadarajan Narayanan, Sumit Garg, Heiko Stuebner, Marek Vasut,
Marek Vasut, Ilias Apalodimas, Zhuxu Ran
The CV1800B RTC subsystem contains a seconds counter and system reset
controls in a shared register range. U-Boot currently binds the system
reset driver from Milk-V Duo board code and accesses fixed MMIO addresses.
The upstream devicetrees describe this subsystem with an RTC node, but
U-Boot has no driver matching that node.
Add an RTC driver for the seconds counter, bind the existing system reset
driver as its child, and obtain the reset register range from the shared
devicetree node. Keep the existing reset requests unchanged, including
the warm-reset sequence currently used for SYSRESET_COLD.
This series depends on the CV18xx upstream-devicetree conversion sent
as v5.
Tested on Milk-V Duo, Milk-V Duo 256M and LicheeRV Nano.
Signed-off-by: Zhuxu Ran <zhuxu_ran@zohomail.com>
---
Changes in v4:
- Add Jingbao Qiu's copyright attribution to the RTC driver.
- Keep the RTC clock handle local to probe().
- Simplify MMIO regmap accesses in the RTC and sysreset paths.
- Link to v3: https://patch.msgid.link/20261007-cv18xx-rtc-sysreset-v3-0-194557fd5e78@zohomail.com
Changes in v3:
- Rename the RTC driver file to cv1800b.c to match the RTC directory
convention.
- Align the CV1800B sysreset register and request-bit definitions.
- Use uppercase hexadecimal digits in the sysreset driver.
- Link to v2: https://patch.msgid.link/20261006-cv18xx-rtc-sysreset-v2-0-67872888384e@zohomail.com
Changes in v2:
- Use CV1800B consistently in the RTC driver filename and identifiers.
- Link to v1: https://patch.msgid.link/20261003-cv18xx-rtc-sysreset-v1-0-c0837e26eb29@zohomail.com
---
Zhuxu Ran (3):
rtc: cv1800b: Add seconds counter support
riscv: sophgo: Enable RTC-backed system reset
sysreset: cv1800b: Use the RTC device node for register access
board/sophgo/milkv_duo/board.c | 5 --
configs/milkv_duo_256m_defconfig | 2 +
configs/milkv_duo_defconfig | 2 +
configs/sipeed_licheerv_nano_defconfig | 2 +
drivers/rtc/Kconfig | 9 +++
drivers/rtc/Makefile | 1 +
drivers/rtc/cv1800b.c | 110 +++++++++++++++++++++++++++++++++
drivers/sysreset/Kconfig | 6 +-
drivers/sysreset/sysreset_cv1800b.c | 80 ++++++++++++++----------
9 files changed, 176 insertions(+), 41 deletions(-)
---
base-commit: a06e89ab05eaa2b8344d521319399333cd760ae5
change-id: 20260929-cv18xx-rtc-sysreset-b816e6306348
prerequisite-message-id: <20260927-milkv-duo-upstream-dts-v5-0-7f64983e59e1@zohomail.com>
prerequisite-patch-id: b8e6815314b7881a02de0066232864d522c4a26c
prerequisite-patch-id: 0df1fa5db1b2bff402b429809796bad99a517483
prerequisite-patch-id: 49e1e8263cf0a5ba8d63c8b598b6382cde5284b2
prerequisite-patch-id: 86dd30e784f022f0a7bb6fbf125c9699467176d4
prerequisite-patch-id: 49070c05ecf58331ec519a57d1b82f8b2b835a89
prerequisite-patch-id: 6b6881e45cc6de6544aaa4509db21611158f4fa1
prerequisite-patch-id: 7198127d4602eeb14212087ce9bb694d84e71a4c
prerequisite-patch-id: 3a58bd8a061707ff27b8538d4897def3b595dc36
prerequisite-patch-id: 9055ea941b73e35d1e825787d7eca14ffceb8e8b
prerequisite-patch-id: 554c1487e8d596e0099677ca88eee0021b1ffbae
Best regards,
--
Zhuxu Ran <zhuxu_ran@zohomail.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v4 1/3] rtc: cv1800b: Add seconds counter support
2026-10-08 11:30 [PATCH v4 0/3] rtc: cv1800b: Use the RTC node for time and system reset Zhuxu Ran
@ 2026-10-08 11:30 ` Zhuxu Ran
2026-10-08 11:30 ` [PATCH v4 2/3] riscv: sophgo: Enable RTC-backed system reset Zhuxu Ran
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Zhuxu Ran @ 2026-10-08 11:30 UTC (permalink / raw)
To: u-boot
Cc: Yao Zi, Tom Rini, Johan Jonker, Alexander Koch, Kongyang Liu,
Hiago De Franco, Thomas Bonnefille, Quentin Schulz,
Peter Robinson, Leo Yu-Chi Liang, Casey Connolly,
Varadarajan Narayanan, Sumit Garg, Heiko Stuebner, Marek Vasut,
Marek Vasut, Ilias Apalodimas, Zhuxu Ran
Add a driver for the CV1800B RTC seconds counter described by the
upstream devicetree. Map the node's register range, enable the RTC
clock, and implement reading and setting the 32-bit counter. Bind
the existing sysreset driver as a child when enabled.
Adapt the register definitions and seconds-counter sequence from
Linux drivers/rtc/rtc-cv1800.c by Jingbao Qiu.
Link: https://git.kernel.org/linus/d9f82683b123ce315cc36c4b20a5bc3d8644f947
Reviewed-by: Hiago De Franco <hfranco@baylibre.com>
Signed-off-by: Zhuxu Ran <zhuxu_ran@zohomail.com>
---
drivers/rtc/Kconfig | 9 +++++
drivers/rtc/Makefile | 1 +
drivers/rtc/cv1800b.c | 110 ++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 120 insertions(+)
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 5b44cc99c97..52d0e51acc3 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -54,6 +54,15 @@ config RTC_ARMADA38X
This adds support for the in-chip RTC that can be found in the
Armada 38x Marvell's SoC devices.
+config RTC_CV1800B
+ bool "Enable Sophgo CV1800B RTC driver"
+ depends on DM_RTC
+ select REGMAP
+ help
+ Enable access to the RTC seconds counter found on Sophgo CV1800B
+ SoCs. When system reset support is enabled, the driver also
+ binds the reset function provided by the RTC subsystem.
+
config RTC_PCF2127
bool "Enable PCF2127 driver"
depends on DM_RTC
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
index 742481ce185..3c480156498 100644
--- a/drivers/rtc/Makefile
+++ b/drivers/rtc/Makefile
@@ -7,6 +7,7 @@
obj-$(CONFIG_$(PHASE_)DM_RTC) += rtc-uclass.o
obj-$(CONFIG_RTC_ARMADA38X) += armada38x.o
+obj-$(CONFIG_RTC_CV1800B) += cv1800b.o
obj-$(CONFIG_RTC_DAVINCI) += davinci.o
obj-$(CONFIG_RTC_DS1307) += ds1307.o
obj-$(CONFIG_RTC_DS1337) += ds1337.o
diff --git a/drivers/rtc/cv1800b.c b/drivers/rtc/cv1800b.c
new file mode 100644
index 00000000000..4ef73ca05e8
--- /dev/null
+++ b/drivers/rtc/cv1800b.c
@@ -0,0 +1,110 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2025 Jingbao Qiu <qiujingbao.dlmu@gmail.com>
+ * Copyright (C) 2026 Zhuxu Ran <zhuxu_ran@zohomail.com>
+ *
+ * Based on the Linux driver by Jingbao Qiu <qiujingbao.dlmu@gmail.com>.
+ */
+
+#include <clk.h>
+#include <dm.h>
+#include <dm/lists.h>
+#include <regmap.h>
+#include <rtc.h>
+#include <linux/bitops.h>
+#include <linux/errno.h>
+#include <linux/err.h>
+
+#define SEC_PULSE_GEN 0x1004
+#define SET_SEC_CNTR_VAL 0x1010
+#define SET_SEC_CNTR_TRIG 0x1014
+#define SEC_CNTR_VAL 0x1018
+#define MACRO_RG_SET_T 0x1498
+
+#define SEL_SEC_PULSE BIT(31)
+
+struct cv1800b_rtc_priv {
+ struct regmap *regmap;
+};
+
+static int cv1800b_rtc_get(struct udevice *dev, struct rtc_time *time)
+{
+ struct cv1800b_rtc_priv *priv = dev_get_priv(dev);
+ u32 value = 0;
+
+ regmap_read(priv->regmap, SEC_PULSE_GEN, &value);
+ if (value & SEL_SEC_PULSE)
+ return -EINVAL;
+
+ regmap_read(priv->regmap, SEC_CNTR_VAL, &value);
+
+ rtc_to_tm(value, time);
+
+ return 0;
+}
+
+static int cv1800b_rtc_set(struct udevice *dev, const struct rtc_time *time)
+{
+ struct cv1800b_rtc_priv *priv = dev_get_priv(dev);
+ time64_t seconds;
+
+ if (time->tm_year < 1970)
+ return -EINVAL;
+
+ seconds = rtc_mktime(time);
+ if (seconds < 0 || seconds > U32_MAX)
+ return -ERANGE;
+
+ regmap_write(priv->regmap, SET_SEC_CNTR_VAL, seconds);
+ regmap_write(priv->regmap, SET_SEC_CNTR_TRIG, 1);
+ regmap_write(priv->regmap, MACRO_RG_SET_T, seconds);
+ regmap_update_bits(priv->regmap, SEC_PULSE_GEN, SEL_SEC_PULSE, 0);
+
+ return 0;
+}
+
+static int cv1800b_rtc_bind(struct udevice *dev)
+{
+ if (!CONFIG_IS_ENABLED(SYSRESET_CV1800B))
+ return 0;
+
+ return device_bind_driver_to_node(dev, "cv1800b_sysreset",
+ "sysreset", dev_ofnode(dev), NULL);
+}
+
+static int cv1800b_rtc_probe(struct udevice *dev)
+{
+ struct cv1800b_rtc_priv *priv = dev_get_priv(dev);
+ struct clk clk;
+ int ret;
+
+ priv->regmap = devm_regmap_init(dev, NULL, NULL, NULL);
+ if (IS_ERR(priv->regmap))
+ return PTR_ERR(priv->regmap);
+
+ ret = clk_get_by_name(dev, "rtc", &clk);
+ if (ret)
+ return ret;
+
+ return clk_enable(&clk);
+}
+
+static const struct rtc_ops cv1800b_rtc_ops = {
+ .get = cv1800b_rtc_get,
+ .set = cv1800b_rtc_set,
+};
+
+static const struct udevice_id cv1800b_rtc_ids[] = {
+ { .compatible = "sophgo,cv1800b-rtc" },
+ { }
+};
+
+U_BOOT_DRIVER(cv1800b_rtc) = {
+ .name = "cv1800b_rtc",
+ .id = UCLASS_RTC,
+ .of_match = cv1800b_rtc_ids,
+ .bind = cv1800b_rtc_bind,
+ .probe = cv1800b_rtc_probe,
+ .ops = &cv1800b_rtc_ops,
+ .priv_auto = sizeof(struct cv1800b_rtc_priv),
+};
--
2.56.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v4 2/3] riscv: sophgo: Enable RTC-backed system reset
2026-10-08 11:30 [PATCH v4 0/3] rtc: cv1800b: Use the RTC node for time and system reset Zhuxu Ran
2026-10-08 11:30 ` [PATCH v4 1/3] rtc: cv1800b: Add seconds counter support Zhuxu Ran
@ 2026-10-08 11:30 ` Zhuxu Ran
2026-10-08 11:30 ` [PATCH v4 3/3] sysreset: cv1800b: Use the RTC device node for register access Zhuxu Ran
2026-10-09 2:38 ` [PATCH v4 0/3] rtc: cv1800b: Use the RTC node for time and system reset Yao Zi
3 siblings, 0 replies; 5+ messages in thread
From: Zhuxu Ran @ 2026-10-08 11:30 UTC (permalink / raw)
To: u-boot
Cc: Yao Zi, Tom Rini, Johan Jonker, Alexander Koch, Kongyang Liu,
Hiago De Franco, Thomas Bonnefille, Quentin Schulz,
Peter Robinson, Leo Yu-Chi Liang, Casey Connolly,
Varadarajan Narayanan, Sumit Garg, Heiko Stuebner, Marek Vasut,
Marek Vasut, Ilias Apalodimas, Zhuxu Ran
Enable the CV1800B RTC driver for Milk-V Duo, Milk-V Duo 256M,
and LicheeRV Nano. Remove the board-level sysreset binding on
Milk-V Duo now that the RTC driver binds the sysreset child from
the devicetree node. Reset register access is unchanged here.
Reviewed-by: Hiago De Franco <hfranco@baylibre.com>
Signed-off-by: Zhuxu Ran <zhuxu_ran@zohomail.com>
---
board/sophgo/milkv_duo/board.c | 5 -----
configs/milkv_duo_256m_defconfig | 2 ++
configs/milkv_duo_defconfig | 2 ++
configs/sipeed_licheerv_nano_defconfig | 2 ++
4 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/board/sophgo/milkv_duo/board.c b/board/sophgo/milkv_duo/board.c
index 34339c42925..3423f54012e 100644
--- a/board/sophgo/milkv_duo/board.c
+++ b/board/sophgo/milkv_duo/board.c
@@ -3,15 +3,10 @@
* Copyright (c) 2024, Kongyang Liu <seashell11234455@gmail.com>
*/
-#include <dm/lists.h>
-
#include "../common/ethernet.h"
int board_init(void)
{
- if (IS_ENABLED(CONFIG_SYSRESET_CV1800B))
- device_bind_driver(gd->dm_root, "cv1800b_sysreset", "sysreset", NULL);
-
if (IS_ENABLED(CONFIG_NET_LEGACY))
cv1800b_ephy_init();
diff --git a/configs/milkv_duo_256m_defconfig b/configs/milkv_duo_256m_defconfig
index fda0baa3277..f15b41e1451 100644
--- a/configs/milkv_duo_256m_defconfig
+++ b/configs/milkv_duo_256m_defconfig
@@ -38,6 +38,8 @@ CONFIG_MMC_SDHCI_CV1800B=y
CONFIG_DM_MDIO=y
CONFIG_DM_MDIO_MUX=y
CONFIG_ETH_DESIGNWARE=y
+CONFIG_DM_RTC=y
+CONFIG_RTC_CV1800B=y
CONFIG_MDIO_MUX_MMIOREG=y
CONFIG_SYS_NS16550=y
CONFIG_SYS_NS16550_MEM32=y
diff --git a/configs/milkv_duo_defconfig b/configs/milkv_duo_defconfig
index 9d6b80362d5..77c8d89701d 100644
--- a/configs/milkv_duo_defconfig
+++ b/configs/milkv_duo_defconfig
@@ -35,6 +35,8 @@ CONFIG_MMC_SDHCI_ADMA=y
CONFIG_MMC_SDHCI_CV1800B=y
CONFIG_SPI_FLASH_MACRONIX=y
CONFIG_ETH_DESIGNWARE=y
+CONFIG_DM_RTC=y
+CONFIG_RTC_CV1800B=y
CONFIG_SYS_NS16550=y
CONFIG_SYS_NS16550_MEM32=y
CONFIG_SPI=y
diff --git a/configs/sipeed_licheerv_nano_defconfig b/configs/sipeed_licheerv_nano_defconfig
index 21b8fece201..75229787d2f 100644
--- a/configs/sipeed_licheerv_nano_defconfig
+++ b/configs/sipeed_licheerv_nano_defconfig
@@ -40,6 +40,8 @@ CONFIG_MMC_SDHCI_ADMA=y
CONFIG_MMC_SDHCI_CV1800B=y
CONFIG_SPI_FLASH_MACRONIX=y
CONFIG_ETH_DESIGNWARE=y
+CONFIG_DM_RTC=y
+CONFIG_RTC_CV1800B=y
CONFIG_SYS_NS16550=y
CONFIG_SYS_NS16550_MEM32=y
CONFIG_SPI=y
--
2.56.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v4 3/3] sysreset: cv1800b: Use the RTC device node for register access
2026-10-08 11:30 [PATCH v4 0/3] rtc: cv1800b: Use the RTC node for time and system reset Zhuxu Ran
2026-10-08 11:30 ` [PATCH v4 1/3] rtc: cv1800b: Add seconds counter support Zhuxu Ran
2026-10-08 11:30 ` [PATCH v4 2/3] riscv: sophgo: Enable RTC-backed system reset Zhuxu Ran
@ 2026-10-08 11:30 ` Zhuxu Ran
2026-10-09 2:38 ` [PATCH v4 0/3] rtc: cv1800b: Use the RTC node for time and system reset Yao Zi
3 siblings, 0 replies; 5+ messages in thread
From: Zhuxu Ran @ 2026-10-08 11:30 UTC (permalink / raw)
To: u-boot
Cc: Yao Zi, Tom Rini, Johan Jonker, Alexander Koch, Kongyang Liu,
Hiago De Franco, Thomas Bonnefille, Quentin Schulz,
Peter Robinson, Leo Yu-Chi Liang, Casey Connolly,
Varadarajan Narayanan, Sumit Garg, Heiko Stuebner, Marek Vasut,
Marek Vasut, Ilias Apalodimas, Zhuxu Ran
The CV1800B system reset driver uses hard-coded RTC register
addresses. Initialize a register map from the RTC node shared with
its parent device instead, and propagate register access errors.
Require the RTC driver that binds the sysreset child. Preserve the
existing reset requests, including the warm-reset sequence used for
SYSRESET_COLD.
Reviewed-by: Hiago De Franco <hfranco@baylibre.com>
Signed-off-by: Zhuxu Ran <zhuxu_ran@zohomail.com>
---
drivers/sysreset/Kconfig | 6 ++-
drivers/sysreset/sysreset_cv1800b.c | 80 +++++++++++++++++++++----------------
2 files changed, 50 insertions(+), 36 deletions(-)
diff --git a/drivers/sysreset/Kconfig b/drivers/sysreset/Kconfig
index 16ef434a8d9..c9f2a552b47 100644
--- a/drivers/sysreset/Kconfig
+++ b/drivers/sysreset/Kconfig
@@ -60,9 +60,11 @@ config SYSRESET_CMD_POWEROFF
endif
config SYSRESET_CV1800B
- bool "Enable support for Sophgo cv1800b System Reset"
+ bool "Enable support for Sophgo CV1800B system reset"
+ depends on RTC_CV1800B
help
- Enable system reset support for Sophgo cv1800b SoC.
+ Enable system reset and power control through the RTC subsystem
+ found on Sophgo CV1800 series SoCs.
config POWEROFF_GPIO
bool "Enable support for GPIO poweroff driver"
diff --git a/drivers/sysreset/sysreset_cv1800b.c b/drivers/sysreset/sysreset_cv1800b.c
index 9cd62772ef4..9b2e3aa7ce2 100644
--- a/drivers/sysreset/sysreset_cv1800b.c
+++ b/drivers/sysreset/sysreset_cv1800b.c
@@ -1,64 +1,76 @@
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2024, Kongyang Liu <seashell11234455@gmail.com>
+ * Copyright (c) 2026, Zhuxu Ran <zhuxu_ran@zohomail.com>
*/
#include <dm.h>
-#include <stdbool.h>
+#include <regmap.h>
#include <sysreset.h>
-#include <wait_bit.h>
-#include <linux/io.h>
+#include <linux/bitops.h>
+#include <linux/err.h>
#include <linux/errno.h>
-#define REG_RTC_BASE (void *)0x05026000
-#define REG_RTC_CTRL_BASE (void *)0x05025000
-#define REG_RTC_EN_SHDN_REQ (REG_RTC_BASE + 0xc0)
-#define REG_RTC_EN_PWR_CYC_REQ (REG_RTC_BASE + 0xc8)
-#define REG_RTC_EN_WARM_RST_REQ (REG_RTC_BASE + 0xcc)
-#define REG_RTC_CTRL_UNLOCKKEY (REG_RTC_CTRL_BASE + 0x4)
-#define REG_RTC_CTRL (REG_RTC_CTRL_BASE + 0x8)
+#define RTC_CTRL_UNLOCKKEY 0x0004
+#define RTC_CTRL 0x0008
+#define RTC_EN_SHDN_REQ 0x10C0
+#define RTC_EN_PWR_CYC_REQ 0x10C8
+#define RTC_EN_WARM_RST_REQ 0x10CC
-#define CTRL_UNLOCKKEY_MAGIC 0xAB18
+#define CTRL_UNLOCKKEY_MAGIC 0xAB18
-/* REG_RTC_CTRL */
-#define BIT_REQ_SHDN BIT(0)
-#define BIT_REQ_PWR_CYC BIT(3)
-#define BIT_REQ_WARM_RST BIT(4)
+#define BIT_REQ_SHDN BIT(0)
+#define BIT_REQ_PWR_CYC BIT(3)
+#define BIT_REQ_WARM_RST BIT(4)
-static struct {
- void *pre_req_reg;
+struct cv1800b_sysreset_priv {
+ struct regmap *regmap;
+};
+
+static const struct {
+ u32 pre_req_reg;
u32 req_bit;
} reset_info[SYSRESET_COUNT] = {
- [SYSRESET_WARM] = { REG_RTC_EN_WARM_RST_REQ, BIT_REQ_WARM_RST },
- [SYSRESET_COLD] = { REG_RTC_EN_WARM_RST_REQ, BIT_REQ_WARM_RST },
- [SYSRESET_POWER] = { REG_RTC_EN_PWR_CYC_REQ, BIT_REQ_PWR_CYC },
- [SYSRESET_POWER_OFF] = { REG_RTC_EN_SHDN_REQ, BIT_REQ_SHDN },
+ [SYSRESET_WARM] = { RTC_EN_WARM_RST_REQ, BIT_REQ_WARM_RST },
+ [SYSRESET_COLD] = { RTC_EN_WARM_RST_REQ, BIT_REQ_WARM_RST },
+ [SYSRESET_POWER] = { RTC_EN_PWR_CYC_REQ, BIT_REQ_PWR_CYC },
+ [SYSRESET_POWER_OFF] = { RTC_EN_SHDN_REQ, BIT_REQ_SHDN },
};
static int cv1800b_sysreset_request(struct udevice *dev, enum sysreset_t type)
{
- u32 reg;
+ struct cv1800b_sysreset_priv *priv = dev_get_priv(dev);
+
+ if (type >= SYSRESET_COUNT)
+ return -EINVAL;
- writel(1, reset_info[type].pre_req_reg);
- writel(CTRL_UNLOCKKEY_MAGIC, REG_RTC_CTRL_UNLOCKKEY);
- reg = readl(REG_RTC_CTRL);
- writel(0xFFFF0800 | reset_info[type].req_bit, REG_RTC_CTRL);
+ regmap_write(priv->regmap, reset_info[type].pre_req_reg, 1);
+ regmap_write(priv->regmap, RTC_CTRL_UNLOCKKEY, CTRL_UNLOCKKEY_MAGIC);
+ regmap_write(priv->regmap, RTC_CTRL,
+ 0xFFFF0800 | reset_info[type].req_bit);
return -EINPROGRESS;
}
+static int cv1800b_sysreset_probe(struct udevice *dev)
+{
+ struct cv1800b_sysreset_priv *priv = dev_get_priv(dev);
+
+ priv->regmap = devm_regmap_init(dev, NULL, NULL, NULL);
+ if (IS_ERR(priv->regmap))
+ return PTR_ERR(priv->regmap);
+
+ return 0;
+}
+
static struct sysreset_ops cv1800b_sysreset = {
.request = cv1800b_sysreset_request,
};
-static const struct udevice_id cv1800b_sysreset_ids[] = {
- { .compatible = "sophgo,cv1800b-sysreset", },
- {},
-};
-
U_BOOT_DRIVER(sysreset_cv1800b) = {
.name = "cv1800b_sysreset",
- .id = UCLASS_SYSRESET,
- .ops = &cv1800b_sysreset,
- .of_match = cv1800b_sysreset_ids
+ .id = UCLASS_SYSRESET,
+ .probe = cv1800b_sysreset_probe,
+ .ops = &cv1800b_sysreset,
+ .priv_auto = sizeof(struct cv1800b_sysreset_priv),
};
--
2.56.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v4 0/3] rtc: cv1800b: Use the RTC node for time and system reset
2026-10-08 11:30 [PATCH v4 0/3] rtc: cv1800b: Use the RTC node for time and system reset Zhuxu Ran
` (2 preceding siblings ...)
2026-10-08 11:30 ` [PATCH v4 3/3] sysreset: cv1800b: Use the RTC device node for register access Zhuxu Ran
@ 2026-10-09 2:38 ` Yao Zi
3 siblings, 0 replies; 5+ messages in thread
From: Yao Zi @ 2026-10-09 2:38 UTC (permalink / raw)
To: Zhuxu Ran, u-boot
Cc: Yao Zi, Tom Rini, Johan Jonker, Alexander Koch, Kongyang Liu,
Hiago De Franco, Thomas Bonnefille, Quentin Schulz,
Peter Robinson, Leo Yu-Chi Liang, Casey Connolly,
Varadarajan Narayanan, Sumit Garg, Heiko Stuebner, Marek Vasut,
Marek Vasut, Ilias Apalodimas
On Thu, Oct 08, 2026 at 07:30:45PM +0800, Zhuxu Ran wrote:
> The CV1800B RTC subsystem contains a seconds counter and system reset
> controls in a shared register range. U-Boot currently binds the system
> reset driver from Milk-V Duo board code and accesses fixed MMIO addresses.
> The upstream devicetrees describe this subsystem with an RTC node, but
> U-Boot has no driver matching that node.
>
> Add an RTC driver for the seconds counter, bind the existing system reset
> driver as its child, and obtain the reset register range from the shared
> devicetree node. Keep the existing reset requests unchanged, including
> the warm-reset sequence currently used for SYSRESET_COLD.
>
> This series depends on the CV18xx upstream-devicetree conversion sent
> as v5.
>
> Tested on Milk-V Duo, Milk-V Duo 256M and LicheeRV Nano.
>
> Signed-off-by: Zhuxu Ran <zhuxu_ran@zohomail.com>
I'll prefer to keep constant names in PATCH 3 unchanged if possible, to
keep the diff minimal and easier for bisecting, but this version is
acceptable.
For the series,
Reviewed-by: Yao Zi <me@ziyao.cc>
Thanks,
Yao Zi
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-10-09 2:39 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-08 11:30 [PATCH v4 0/3] rtc: cv1800b: Use the RTC node for time and system reset Zhuxu Ran
2026-10-08 11:30 ` [PATCH v4 1/3] rtc: cv1800b: Add seconds counter support Zhuxu Ran
2026-10-08 11:30 ` [PATCH v4 2/3] riscv: sophgo: Enable RTC-backed system reset Zhuxu Ran
2026-10-08 11:30 ` [PATCH v4 3/3] sysreset: cv1800b: Use the RTC device node for register access Zhuxu Ran
2026-10-09 2:38 ` [PATCH v4 0/3] rtc: cv1800b: Use the RTC node for time and system reset Yao Zi
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.