linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/10] arm64 support for Milk-V Duo Module 01 EVB
@ 2025-02-09 22:06 Alexander Sverdlin
  2025-02-09 22:06 ` [PATCH 06/10] dt-bindings: mfd: syscon: Add Cvitek CV18xx rtcsys core and ctrl compatible Alexander Sverdlin
                   ` (6 more replies)
  0 siblings, 7 replies; 25+ messages in thread
From: Alexander Sverdlin @ 2025-02-09 22:06 UTC (permalink / raw)
  To: soc
  Cc: Alexander Sverdlin, Chen Wang, Inochi Amaoto, Lee Jones,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Philipp Zabel,
	Catalin Marinas, Will Deacon, Arnd Bergmann, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Sebastian Reichel, devicetree,
	Haylen Chu, linux-arm-kernel, linux-riscv, linux-pm

This series adds very basic support for Milk-V Duo Module 01 EVB [1] in
arm64 mode. The SoC (SG2000) is dual-arch, RiscV and ARM64, the latter has
been chosen because the upstream toolchain can be utilized.

Sophgo SG2000 seems to be a continuation of the Cvitek CV18xx series, same
peripherals with an addition of ARM64 core. Therefore it would be
beneficial not to copy-paste the peripherals' device-tree, but rather split
the most suitable riscv DT into ARCH-specific and peripherals parts and
just include the latter on the arm64 side.

This series adds the device-tree for Milk-V Duo Module 01 EVB, which
in turn contains Milk-V Duo Module 01 (separate .dtsi) on it, which has
SG2000 SoC inside (separate .dtsi).

This series has been tested with Sophgo-provided U-Boot binary [2]: it
boots from SD card, pinctrl, serial, GPIO drivers are functional (same
as for RiscV-based CV18xx SoCs).
New reset driver is provided as an alternative to the ATF PSCI handler,
which Sophgo only provides in binary form.

Partial SoC documentation is available [3].

This series lacks the support of:
- USB
- Audio
- Ethernet
- WiFi
- Bluetooth
- eMMC
- Video

It would probably make sense that the whole series would go into SOC tree,
even though technically nothing prevents the reboot/reset driver to come
in PM/reset tree. If everything would come together, `reboot` command would
work out of the box.

[1] https://milkv.io/docs/duo/getting-started/duo-module-01
[2] https://github.com/milkv-duo/duo-buildroot-sdk-v2/releases/
[3] https://github.com/sophgo/sophgo-doc/releases/download/sg2000-trm-v1.01/sg2000_trm_en.pdf

Alexander Sverdlin (10):
  arm64: Add SOPHGO SOC family Kconfig support
  riscv: dts: sophgo: cv18xx: Split into CPU core and peripheral parts
  arm64: dts: sophgo: Add initial SG2000 SoC device tree
  arm64: dts: sophgo: Add Duo Module 01
  arm64: dts: sophgo: Add Duo Module 01 Evaluation Board
  dt-bindings: mfd: syscon: Add Cvitek CV18xx rtcsys core and ctrl
    compatible
  dt-bindings: reset: sophgo: Add CV18xx reset controller
  riscv/arm64: dts: cv18xx: Add sysctl and reset nodes
  power: reset: cv18xx: New driver
  arm64: defconfig: Enable rudimentary Sophgo SG2000 support

 .../devicetree/bindings/mfd/syscon.yaml       |   4 +
 .../bindings/reset/sophgo,cv1800-reset.yaml   |  38 ++
 MAINTAINERS                                   |   1 +
 arch/arm64/Kconfig.platforms                  |  12 +
 arch/arm64/boot/dts/Makefile                  |   1 +
 arch/arm64/boot/dts/sophgo/Makefile           |   2 +
 arch/arm64/boot/dts/sophgo/sg2000.dtsi        |  79 +++++
 .../sophgo/sg2000_milkv_duo_module_01.dtsi    |  84 +++++
 .../sophgo/sg2000_milkv_duo_module_01_evb.dts |  30 ++
 arch/arm64/configs/defconfig                  |   3 +
 arch/riscv/boot/dts/sophgo/cv181x.dtsi        |   2 +-
 arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi | 329 ++++++++++++++++++
 arch/riscv/boot/dts/sophgo/cv18xx.dtsi        | 305 +---------------
 drivers/power/reset/Kconfig                   |  12 +
 drivers/power/reset/Makefile                  |   1 +
 drivers/power/reset/cv18xx-reset.c            |  89 +++++
 16 files changed, 689 insertions(+), 303 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/reset/sophgo,cv1800-reset.yaml
 create mode 100644 arch/arm64/boot/dts/sophgo/Makefile
 create mode 100644 arch/arm64/boot/dts/sophgo/sg2000.dtsi
 create mode 100644 arch/arm64/boot/dts/sophgo/sg2000_milkv_duo_module_01.dtsi
 create mode 100644 arch/arm64/boot/dts/sophgo/sg2000_milkv_duo_module_01_evb.dts
 create mode 100644 arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi
 create mode 100644 drivers/power/reset/cv18xx-reset.c

-- 
2.48.1


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

* [PATCH 06/10] dt-bindings: mfd: syscon: Add Cvitek CV18xx rtcsys core and ctrl compatible
  2025-02-09 22:06 [PATCH 00/10] arm64 support for Milk-V Duo Module 01 EVB Alexander Sverdlin
@ 2025-02-09 22:06 ` Alexander Sverdlin
  2025-02-10  5:15   ` Inochi Amaoto
  2025-02-10  8:48   ` Krzysztof Kozlowski
  2025-02-09 22:06 ` [PATCH 07/10] dt-bindings: reset: sophgo: Add CV18xx reset controller Alexander Sverdlin
                   ` (5 subsequent siblings)
  6 siblings, 2 replies; 25+ messages in thread
From: Alexander Sverdlin @ 2025-02-09 22:06 UTC (permalink / raw)
  To: soc
  Cc: Alexander Sverdlin, Chen Wang, Inochi Amaoto, linux-pm,
	linux-riscv, devicetree, Haylen Chu, linux-arm-kernel,
	Sebastian Reichel, Arnd Bergmann, Philipp Zabel, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Lee Jones

These syscon blocks will be used for CV18xx reset driver.

Signed-off-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
---
 Documentation/devicetree/bindings/mfd/syscon.yaml | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/mfd/syscon.yaml b/Documentation/devicetree/bindings/mfd/syscon.yaml
index 4d67ff26d445..5a0b102d1bd9 100644
--- a/Documentation/devicetree/bindings/mfd/syscon.yaml
+++ b/Documentation/devicetree/bindings/mfd/syscon.yaml
@@ -108,6 +108,8 @@ select:
           - rockchip,rk3576-qos
           - rockchip,rk3588-qos
           - rockchip,rv1126-qos
+          - sophgo,cv1800-rtcsys-core
+          - sophgo,cv1800-rtcsys-ctrl
           - st,spear1340-misc
           - stericsson,nomadik-pmu
           - starfive,jh7100-sysmain
@@ -207,6 +209,8 @@ properties:
           - rockchip,rk3576-qos
           - rockchip,rk3588-qos
           - rockchip,rv1126-qos
+          - sophgo,cv1800-rtcsys-core
+          - sophgo,cv1800-rtcsys-ctrl
           - st,spear1340-misc
           - stericsson,nomadik-pmu
           - starfive,jh7100-sysmain
-- 
2.48.1


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

* [PATCH 07/10] dt-bindings: reset: sophgo: Add CV18xx reset controller
  2025-02-09 22:06 [PATCH 00/10] arm64 support for Milk-V Duo Module 01 EVB Alexander Sverdlin
  2025-02-09 22:06 ` [PATCH 06/10] dt-bindings: mfd: syscon: Add Cvitek CV18xx rtcsys core and ctrl compatible Alexander Sverdlin
@ 2025-02-09 22:06 ` Alexander Sverdlin
  2025-02-10  5:36   ` Inochi Amaoto
  2025-02-10  8:49   ` Krzysztof Kozlowski
  2025-02-09 22:06 ` [PATCH 08/10] riscv/arm64: dts: cv18xx: Add sysctl and reset nodes Alexander Sverdlin
                   ` (4 subsequent siblings)
  6 siblings, 2 replies; 25+ messages in thread
From: Alexander Sverdlin @ 2025-02-09 22:06 UTC (permalink / raw)
  To: soc
  Cc: Alexander Sverdlin, Chen Wang, Inochi Amaoto, linux-pm,
	linux-riscv, devicetree, Haylen Chu, linux-arm-kernel,
	Sebastian Reichel, Arnd Bergmann, Philipp Zabel, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Lee Jones

Add DT bindings for CV18xx reset controller. The power/reboot driver is
going to use only 4 bits from two different MMIO regions which can be
potentially used by other subsystems/drivers, therefore the resources
are not being claimed directly by the device/driver, but via syscons
instead.

Link: https://github.com/sophgo/sophgo-doc/releases/download/sg2000-trm-v1.01/sg2000_trm_en.pdf
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
---
 .../bindings/reset/sophgo,cv1800-reset.yaml   | 38 +++++++++++++++++++
 1 file changed, 38 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/reset/sophgo,cv1800-reset.yaml

diff --git a/Documentation/devicetree/bindings/reset/sophgo,cv1800-reset.yaml b/Documentation/devicetree/bindings/reset/sophgo,cv1800-reset.yaml
new file mode 100644
index 000000000000..4f058f99df5f
--- /dev/null
+++ b/Documentation/devicetree/bindings/reset/sophgo,cv1800-reset.yaml
@@ -0,0 +1,38 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/reset/sophgo,cv1800-reset.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Cvitek CV18xx/Sophgo SG2000 Reset Controller
+
+maintainers:
+  - Alexander Sverdlin <alexander.sverdlin@gmail.com>
+
+properties:
+  compatible:
+    const: sophgo,cv1800-reset
+
+  sophgo,rtcsys-ctrl:
+    description: phandle of the "RTCSYS_CTRL" syscon block
+    $ref: /schemas/types.yaml#/definitions/phandle
+
+  sophgo,rtcsys-core:
+    description: phandle of the "RTCSYS_CORE" syscon block
+    $ref: /schemas/types.yaml#/definitions/phandle
+
+required:
+  - compatible
+  - sophgo,rtcsys-ctrl
+  - sophgo,rtcsys-core
+
+additionalProperties: false
+
+examples:
+  - |
+    soc-reset {
+        compatible = "sophgo,cv1800-reset";
+        sophgo,rtcsys-ctrl = <&rtcsys_ctrl>;
+        sophgo,rtcsys-core = <&rtcsys_core>;
+    };
+...
-- 
2.48.1


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

* [PATCH 08/10] riscv/arm64: dts: cv18xx: Add sysctl and reset nodes
  2025-02-09 22:06 [PATCH 00/10] arm64 support for Milk-V Duo Module 01 EVB Alexander Sverdlin
  2025-02-09 22:06 ` [PATCH 06/10] dt-bindings: mfd: syscon: Add Cvitek CV18xx rtcsys core and ctrl compatible Alexander Sverdlin
  2025-02-09 22:06 ` [PATCH 07/10] dt-bindings: reset: sophgo: Add CV18xx reset controller Alexander Sverdlin
@ 2025-02-09 22:06 ` Alexander Sverdlin
  2025-02-10  5:13   ` Inochi Amaoto
  2025-02-10  8:51   ` Krzysztof Kozlowski
  2025-02-09 22:06 ` [PATCH 09/10] power: reset: cv18xx: New driver Alexander Sverdlin
                   ` (3 subsequent siblings)
  6 siblings, 2 replies; 25+ messages in thread
From: Alexander Sverdlin @ 2025-02-09 22:06 UTC (permalink / raw)
  To: soc
  Cc: Alexander Sverdlin, Chen Wang, Inochi Amaoto, linux-pm,
	linux-riscv, devicetree, Haylen Chu, linux-arm-kernel,
	Sebastian Reichel, Arnd Bergmann, Philipp Zabel, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Lee Jones

Add reset controller node and required sysctl nodes.

Signed-off-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
---
 arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi b/arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi
index 53834b0658b2..d793b6db4ed1 100644
--- a/arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi
+++ b/arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi
@@ -309,5 +309,21 @@ dmac: dma-controller@4330000 {
 			snps,data-width = <4>;
 			status = "disabled";
 		};
+
+		rtcsys_ctrl: syscon@5025000 {
+			compatible = "sophgo,cv1800-rtcsys-ctrl", "syscon";
+			reg = <0x05025000 0x1000>;
+		};
+
+		rtcsys_core: syscon@5026000 {
+			compatible = "sophgo,cv1800-rtcsys-core", "syscon";
+			reg = <0x05026000 0x1000>;
+		};
+
+		soc-reset {
+			compatible = "sophgo,cv1800-reset";
+			sophgo,rtcsys-ctrl = <&rtcsys_ctrl>;
+			sophgo,rtcsys-core = <&rtcsys_core>;
+		};
 	};
 };
-- 
2.48.1


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

* [PATCH 09/10] power: reset: cv18xx: New driver
  2025-02-09 22:06 [PATCH 00/10] arm64 support for Milk-V Duo Module 01 EVB Alexander Sverdlin
                   ` (2 preceding siblings ...)
  2025-02-09 22:06 ` [PATCH 08/10] riscv/arm64: dts: cv18xx: Add sysctl and reset nodes Alexander Sverdlin
@ 2025-02-09 22:06 ` Alexander Sverdlin
  2025-02-10  8:52   ` Krzysztof Kozlowski
  2025-02-10  0:02 ` [PATCH 00/10] arm64 support for Milk-V Duo Module 01 EVB Chen Wang
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 25+ messages in thread
From: Alexander Sverdlin @ 2025-02-09 22:06 UTC (permalink / raw)
  To: soc
  Cc: Alexander Sverdlin, Chen Wang, Inochi Amaoto, linux-pm,
	linux-riscv, Haylen Chu, linux-arm-kernel, Sebastian Reichel,
	Arnd Bergmann, Philipp Zabel, Lee Jones

Add new driver to support cold and warm reset on Cvitek CV18xx and Sophgo
SG2000 SoCs.

Link: https://github.com/sophgo/sophgo-doc/releases/download/sg2000-trm-v1.01/sg2000_trm_en.pdf
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
---
 MAINTAINERS                        |  1 +
 drivers/power/reset/Kconfig        | 12 ++++
 drivers/power/reset/Makefile       |  1 +
 drivers/power/reset/cv18xx-reset.c | 89 ++++++++++++++++++++++++++++++
 4 files changed, 103 insertions(+)
 create mode 100644 drivers/power/reset/cv18xx-reset.c

diff --git a/MAINTAINERS b/MAINTAINERS
index e4f5d8f68581..b7fec02f7673 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -22147,6 +22147,7 @@ M:	Chen Wang <unicorn_wang@outlook.com>
 M:	Inochi Amaoto <inochiama@outlook.com>
 T:	git https://github.com/sophgo/linux.git
 S:	Maintained
+F:	drivers/power/reset/cv18xx-reset.c
 N:	sophgo
 K:	sophgo
 
diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
index 60bf0ca64cf3..d41ed3c2a30d 100644
--- a/drivers/power/reset/Kconfig
+++ b/drivers/power/reset/Kconfig
@@ -75,6 +75,18 @@ config POWER_RESET_BRCMSTB
 	  Say Y here if you have a Broadcom STB board and you wish
 	  to have restart support.
 
+config POWER_RESET_CV18XX
+	bool "Cvitek CV18XX/Sophgo SG2000 reset driver"
+	depends on ARCH_SOPHGO || COMPILE_TEST
+	depends on MFD_SYSCON
+	default ARCH_SOPHGO
+	help
+	  This driver provides restart support for Cvitek CV18xx and
+	  Sophgo SG2000 SoCs.
+
+	  Say Y here if you have a Cvitek CV18xx or Sophgo SG2000 SoC and
+	  you wish to have restart support.
+
 config POWER_RESET_EP93XX
 	bool "Cirrus EP93XX reset driver" if COMPILE_TEST
 	depends on MFD_SYSCON
diff --git a/drivers/power/reset/Makefile b/drivers/power/reset/Makefile
index 10782d32e1da..ce24e74e0477 100644
--- a/drivers/power/reset/Makefile
+++ b/drivers/power/reset/Makefile
@@ -7,6 +7,7 @@ obj-$(CONFIG_POWER_RESET_ATC260X) += atc260x-poweroff.o
 obj-$(CONFIG_POWER_RESET_AXXIA) += axxia-reset.o
 obj-$(CONFIG_POWER_RESET_BRCMKONA) += brcm-kona-reset.o
 obj-$(CONFIG_POWER_RESET_BRCMSTB) += brcmstb-reboot.o
+obj-$(CONFIG_POWER_RESET_CV18XX) += cv18xx-reset.o
 obj-$(CONFIG_POWER_RESET_EP93XX) += ep93xx-restart.o
 obj-$(CONFIG_POWER_RESET_GEMINI_POWEROFF) += gemini-poweroff.o
 obj-$(CONFIG_POWER_RESET_GPIO) += gpio-poweroff.o
diff --git a/drivers/power/reset/cv18xx-reset.c b/drivers/power/reset/cv18xx-reset.c
new file mode 100644
index 000000000000..bc1797e7d3f5
--- /dev/null
+++ b/drivers/power/reset/cv18xx-reset.c
@@ -0,0 +1,89 @@
+// SPDX-License-Identifier: GPL-2.0-only
+
+#include <linux/io.h>
+#include <linux/module.h>
+#include <linux/notifier.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/reboot.h>
+#include <linux/regmap.h>
+#include <linux/mfd/syscon.h>
+
+/* RTCSYS_CTRL registers */
+#define RTC_CTRL_UNLOCKKEY		0x04
+#define RTC_CTRL0			0x08
+#define  REQ_PWR_CYC			BIT(3)
+#define  REQ_WARM_RST			BIT(4)
+
+/* RTCSYS_CORE registers */
+#define RTC_EN_PWR_CYC_REQ		0xC8
+#define RTC_EN_WARM_RST_REQ		0xCC
+
+static struct regmap *rtcsys_ctrl_regs;
+static struct regmap *rtcsys_core_regs;
+
+static int cv18xx_restart_handler(struct sys_off_data *data)
+{
+	u32 reg_en = RTC_EN_WARM_RST_REQ;
+	u32 request = 0xFFFF0800;
+
+	if (data->mode == REBOOT_COLD) {
+		reg_en = RTC_EN_PWR_CYC_REQ;
+		request |= REQ_PWR_CYC;
+	} else {
+		request |= REQ_WARM_RST;
+	}
+
+	/* Enable reset request */
+	regmap_write(rtcsys_core_regs, reg_en, 1);
+	/* Enable CTRL0 register access */
+	regmap_write(rtcsys_ctrl_regs, RTC_CTRL_UNLOCKKEY, 0xAB18);
+	/* Request reset */
+	regmap_write(rtcsys_ctrl_regs, RTC_CTRL0, request);
+
+	return NOTIFY_DONE;
+}
+
+static int cv18xx_reset_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct device_node *np = dev->of_node;
+	int ret;
+
+	if (!np)
+		return -ENODEV;
+
+	rtcsys_ctrl_regs = syscon_regmap_lookup_by_phandle(np, "sophgo,rtcsys-ctrl");
+	if (IS_ERR(rtcsys_ctrl_regs))
+		return dev_err_probe(dev, PTR_ERR(rtcsys_ctrl_regs),
+				     "sophgo,rtcsys-ctrl lookup failed\n");
+
+	rtcsys_core_regs = syscon_regmap_lookup_by_phandle(np, "sophgo,rtcsys-core");
+	if (IS_ERR(rtcsys_core_regs))
+		return dev_err_probe(dev, PTR_ERR(rtcsys_core_regs),
+				     "sophgo,rtcsys-core lookup failed\n");
+
+	ret = devm_register_restart_handler(&pdev->dev, cv18xx_restart_handler, NULL);
+	if (ret)
+		dev_err(&pdev->dev, "Cannot register restart handler (%pe)\n", ERR_PTR(ret));
+	return ret;
+}
+
+static const struct of_device_id cv18xx_reset_of_match[] = {
+	{ .compatible = "sophgo,cv1800-reset" },
+	{}
+};
+MODULE_DEVICE_TABLE(platform, cv18xx_reset_of_match);
+
+static struct platform_driver cv18xx_reset_driver = {
+	.probe = cv18xx_reset_probe,
+	.driver = {
+		.name = "cv18xx-reset",
+		.of_match_table = cv18xx_reset_of_match,
+	},
+};
+module_platform_driver(cv18xx_reset_driver);
+
+MODULE_AUTHOR("Alexander Sverdlin <alexander.sverdlin@gmail.com>");
+MODULE_DESCRIPTION("Cvitek CV18xx/Sophgo SG2000 Reset Driver");
+MODULE_ALIAS("platform:cv18xx-reset");
-- 
2.48.1


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

* Re: [PATCH 00/10] arm64 support for Milk-V Duo Module 01 EVB
  2025-02-09 22:06 [PATCH 00/10] arm64 support for Milk-V Duo Module 01 EVB Alexander Sverdlin
                   ` (3 preceding siblings ...)
  2025-02-09 22:06 ` [PATCH 09/10] power: reset: cv18xx: New driver Alexander Sverdlin
@ 2025-02-10  0:02 ` Chen Wang
  2025-02-10  5:15   ` Inochi Amaoto
  2025-02-10  5:33 ` Inochi Amaoto
  2025-02-10 16:22 ` Rob Herring (Arm)
  6 siblings, 1 reply; 25+ messages in thread
From: Chen Wang @ 2025-02-10  0:02 UTC (permalink / raw)
  To: Alexander Sverdlin, soc, Inochi Amaoto
  Cc: Inochi Amaoto, Lee Jones, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Philipp Zabel, Catalin Marinas, Will Deacon,
	Arnd Bergmann, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Sebastian Reichel, devicetree, Haylen Chu, linux-arm-kernel,
	linux-riscv, linux-pm


On 2025/2/10 6:06, Alexander Sverdlin wrote:
> This series adds very basic support for Milk-V Duo Module 01 EVB [1] in
> arm64 mode. The SoC (SG2000) is dual-arch, RiscV and ARM64, the latter has
> been chosen because the upstream toolchain can be utilized.
>
> Sophgo SG2000 seems to be a continuation of the Cvitek CV18xx series, same
> peripherals with an addition of ARM64 core. Therefore it would be
> beneficial not to copy-paste the peripherals' device-tree, but rather split
> the most suitable riscv DT into ARCH-specific and peripherals parts and
> just include the latter on the arm64 side.
>
> This series adds the device-tree for Milk-V Duo Module 01 EVB, which
> in turn contains Milk-V Duo Module 01 (separate .dtsi) on it, which has
> SG2000 SoC inside (separate .dtsi).
>
> This series has been tested with Sophgo-provided U-Boot binary [2]: it
> boots from SD card, pinctrl, serial, GPIO drivers are functional (same
> as for RiscV-based CV18xx SoCs).
> New reset driver is provided as an alternative to the ATF PSCI handler,
> which Sophgo only provides in binary form.

I just see Inochi posted a patchset about cv18xx reset driver [1]. FYI.

Maybe you and Inochi need to communicate with each other and synchronize 
the related work in this regard.

Link: 
https://lore.kernel.org/linux-riscv/20250209122936.2338821-1-inochiama@gmail.com/ 
[1]

>
> Partial SoC documentation is available [3].
>
> This series lacks the support of:
> - USB
> - Audio
> - Ethernet
> - WiFi
> - Bluetooth
> - eMMC
> - Video
>
> It would probably make sense that the whole series would go into SOC tree,
> even though technically nothing prevents the reboot/reset driver to come
> in PM/reset tree. If everything would come together, `reboot` command would
> work out of the box.
>
> [1] https://milkv.io/docs/duo/getting-started/duo-module-01
> [2] https://github.com/milkv-duo/duo-buildroot-sdk-v2/releases/
> [3] https://github.com/sophgo/sophgo-doc/releases/download/sg2000-trm-v1.01/sg2000_trm_en.pdf
>
> Alexander Sverdlin (10):
>    arm64: Add SOPHGO SOC family Kconfig support
>    riscv: dts: sophgo: cv18xx: Split into CPU core and peripheral parts
>    arm64: dts: sophgo: Add initial SG2000 SoC device tree
>    arm64: dts: sophgo: Add Duo Module 01
>    arm64: dts: sophgo: Add Duo Module 01 Evaluation Board
>    dt-bindings: mfd: syscon: Add Cvitek CV18xx rtcsys core and ctrl
>      compatible
>    dt-bindings: reset: sophgo: Add CV18xx reset controller
>    riscv/arm64: dts: cv18xx: Add sysctl and reset nodes
>    power: reset: cv18xx: New driver
>    arm64: defconfig: Enable rudimentary Sophgo SG2000 support
>
>   .../devicetree/bindings/mfd/syscon.yaml       |   4 +
>   .../bindings/reset/sophgo,cv1800-reset.yaml   |  38 ++
>   MAINTAINERS                                   |   1 +
>   arch/arm64/Kconfig.platforms                  |  12 +
>   arch/arm64/boot/dts/Makefile                  |   1 +
>   arch/arm64/boot/dts/sophgo/Makefile           |   2 +
>   arch/arm64/boot/dts/sophgo/sg2000.dtsi        |  79 +++++
>   .../sophgo/sg2000_milkv_duo_module_01.dtsi    |  84 +++++
>   .../sophgo/sg2000_milkv_duo_module_01_evb.dts |  30 ++
>   arch/arm64/configs/defconfig                  |   3 +
>   arch/riscv/boot/dts/sophgo/cv181x.dtsi        |   2 +-
>   arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi | 329 ++++++++++++++++++
>   arch/riscv/boot/dts/sophgo/cv18xx.dtsi        | 305 +---------------
>   drivers/power/reset/Kconfig                   |  12 +
>   drivers/power/reset/Makefile                  |   1 +
>   drivers/power/reset/cv18xx-reset.c            |  89 +++++
>   16 files changed, 689 insertions(+), 303 deletions(-)
>   create mode 100644 Documentation/devicetree/bindings/reset/sophgo,cv1800-reset.yaml
>   create mode 100644 arch/arm64/boot/dts/sophgo/Makefile
>   create mode 100644 arch/arm64/boot/dts/sophgo/sg2000.dtsi
>   create mode 100644 arch/arm64/boot/dts/sophgo/sg2000_milkv_duo_module_01.dtsi
>   create mode 100644 arch/arm64/boot/dts/sophgo/sg2000_milkv_duo_module_01_evb.dts
>   create mode 100644 arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi
>   create mode 100644 drivers/power/reset/cv18xx-reset.c
>

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

* Re: [PATCH 08/10] riscv/arm64: dts: cv18xx: Add sysctl and reset nodes
  2025-02-09 22:06 ` [PATCH 08/10] riscv/arm64: dts: cv18xx: Add sysctl and reset nodes Alexander Sverdlin
@ 2025-02-10  5:13   ` Inochi Amaoto
  2025-02-10 11:47     ` Alexander Sverdlin
  2025-02-10  8:51   ` Krzysztof Kozlowski
  1 sibling, 1 reply; 25+ messages in thread
From: Inochi Amaoto @ 2025-02-10  5:13 UTC (permalink / raw)
  To: Alexander Sverdlin, soc
  Cc: Chen Wang, Inochi Amaoto, linux-pm, linux-riscv, devicetree,
	Haylen Chu, linux-arm-kernel, Sebastian Reichel, Arnd Bergmann,
	Philipp Zabel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Lee Jones, Inochi Amaoto

On Sun, Feb 09, 2025 at 11:06:33PM +0100, Alexander Sverdlin wrote:
> Add reset controller node and required sysctl nodes.
> 
> Signed-off-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
> ---
>  arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi b/arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi
> index 53834b0658b2..d793b6db4ed1 100644
> --- a/arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi
> +++ b/arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi
> @@ -309,5 +309,21 @@ dmac: dma-controller@4330000 {
>  			snps,data-width = <4>;
>  			status = "disabled";
>  		};
> +

> +		rtcsys_ctrl: syscon@5025000 {
> +			compatible = "sophgo,cv1800-rtcsys-ctrl", "syscon";
> +			reg = <0x05025000 0x1000>;
> +		};
> +
> +		rtcsys_core: syscon@5026000 {
> +			compatible = "sophgo,cv1800-rtcsys-core", "syscon";
> +			reg = <0x05026000 0x1000>;
> +		};
> +
> +		soc-reset {
> +			compatible = "sophgo,cv1800-reset";
> +			sophgo,rtcsys-ctrl = <&rtcsys_ctrl>;
> +			sophgo,rtcsys-core = <&rtcsys_core>;
> +		};

I think these node is not suitable for riscv. It should use SBI SRST
extension to restart.

Regards,
Inochi

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

* Re: [PATCH 00/10] arm64 support for Milk-V Duo Module 01 EVB
  2025-02-10  0:02 ` [PATCH 00/10] arm64 support for Milk-V Duo Module 01 EVB Chen Wang
@ 2025-02-10  5:15   ` Inochi Amaoto
  0 siblings, 0 replies; 25+ messages in thread
From: Inochi Amaoto @ 2025-02-10  5:15 UTC (permalink / raw)
  To: Alexander Sverdlin
  Cc: Chen Wang, soc, Inochi Amaoto, Lee Jones, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Philipp Zabel, Catalin Marinas,
	Will Deacon, Arnd Bergmann, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Sebastian Reichel, devicetree, Haylen Chu,
	linux-arm-kernel, linux-riscv, linux-pm, Inochi Amaoto

On Mon, Feb 10, 2025 at 08:02:12AM +0800, Chen Wang wrote:
> 
> On 2025/2/10 6:06, Alexander Sverdlin wrote:
> > This series adds very basic support for Milk-V Duo Module 01 EVB [1] in
> > arm64 mode. The SoC (SG2000) is dual-arch, RiscV and ARM64, the latter has
> > been chosen because the upstream toolchain can be utilized.
> > 
> > Sophgo SG2000 seems to be a continuation of the Cvitek CV18xx series, same
> > peripherals with an addition of ARM64 core. Therefore it would be
> > beneficial not to copy-paste the peripherals' device-tree, but rather split
> > the most suitable riscv DT into ARCH-specific and peripherals parts and
> > just include the latter on the arm64 side.
> > 
> > This series adds the device-tree for Milk-V Duo Module 01 EVB, which
> > in turn contains Milk-V Duo Module 01 (separate .dtsi) on it, which has
> > SG2000 SoC inside (separate .dtsi).
> > 
> > This series has been tested with Sophgo-provided U-Boot binary [2]: it
> > boots from SD card, pinctrl, serial, GPIO drivers are functional (same
> > as for RiscV-based CV18xx SoCs).
> > New reset driver is provided as an alternative to the ATF PSCI handler,
> > which Sophgo only provides in binary form.
> 
> I just see Inochi posted a patchset about cv18xx reset driver [1]. FYI.
> 
> Maybe you and Inochi need to communicate with each other and synchronize the
> related work in this regard.
> 
> Link: https://lore.kernel.org/linux-riscv/20250209122936.2338821-1-inochiama@gmail.com/
> [1]
> 

It is a power restart device, not the reset controller, I suggests you change
the device name.

> > 
> > Partial SoC documentation is available [3].
> > 
> > This series lacks the support of:
> > - USB
> > - Audio
> > - Ethernet
> > - WiFi
> > - Bluetooth
> > - eMMC
> > - Video
> > 
> > It would probably make sense that the whole series would go into SOC tree,
> > even though technically nothing prevents the reboot/reset driver to come
> > in PM/reset tree. If everything would come together, `reboot` command would
> > work out of the box.
> > 
> > [1] https://milkv.io/docs/duo/getting-started/duo-module-01
> > [2] https://github.com/milkv-duo/duo-buildroot-sdk-v2/releases/
> > [3] https://github.com/sophgo/sophgo-doc/releases/download/sg2000-trm-v1.01/sg2000_trm_en.pdf
> > 
> > Alexander Sverdlin (10):
> >    arm64: Add SOPHGO SOC family Kconfig support
> >    riscv: dts: sophgo: cv18xx: Split into CPU core and peripheral parts
> >    arm64: dts: sophgo: Add initial SG2000 SoC device tree
> >    arm64: dts: sophgo: Add Duo Module 01
> >    arm64: dts: sophgo: Add Duo Module 01 Evaluation Board
> >    dt-bindings: mfd: syscon: Add Cvitek CV18xx rtcsys core and ctrl
> >      compatible
> >    dt-bindings: reset: sophgo: Add CV18xx reset controller
> >    riscv/arm64: dts: cv18xx: Add sysctl and reset nodes
> >    power: reset: cv18xx: New driver
> >    arm64: defconfig: Enable rudimentary Sophgo SG2000 support
> > 
> >   .../devicetree/bindings/mfd/syscon.yaml       |   4 +
> >   .../bindings/reset/sophgo,cv1800-reset.yaml   |  38 ++
> >   MAINTAINERS                                   |   1 +
> >   arch/arm64/Kconfig.platforms                  |  12 +
> >   arch/arm64/boot/dts/Makefile                  |   1 +
> >   arch/arm64/boot/dts/sophgo/Makefile           |   2 +
> >   arch/arm64/boot/dts/sophgo/sg2000.dtsi        |  79 +++++
> >   .../sophgo/sg2000_milkv_duo_module_01.dtsi    |  84 +++++
> >   .../sophgo/sg2000_milkv_duo_module_01_evb.dts |  30 ++
> >   arch/arm64/configs/defconfig                  |   3 +
> >   arch/riscv/boot/dts/sophgo/cv181x.dtsi        |   2 +-
> >   arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi | 329 ++++++++++++++++++
> >   arch/riscv/boot/dts/sophgo/cv18xx.dtsi        | 305 +---------------
> >   drivers/power/reset/Kconfig                   |  12 +
> >   drivers/power/reset/Makefile                  |   1 +
> >   drivers/power/reset/cv18xx-reset.c            |  89 +++++
> >   16 files changed, 689 insertions(+), 303 deletions(-)
> >   create mode 100644 Documentation/devicetree/bindings/reset/sophgo,cv1800-reset.yaml
> >   create mode 100644 arch/arm64/boot/dts/sophgo/Makefile
> >   create mode 100644 arch/arm64/boot/dts/sophgo/sg2000.dtsi
> >   create mode 100644 arch/arm64/boot/dts/sophgo/sg2000_milkv_duo_module_01.dtsi
> >   create mode 100644 arch/arm64/boot/dts/sophgo/sg2000_milkv_duo_module_01_evb.dts
> >   create mode 100644 arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi
> >   create mode 100644 drivers/power/reset/cv18xx-reset.c
> > 

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

* Re: [PATCH 06/10] dt-bindings: mfd: syscon: Add Cvitek CV18xx rtcsys core and ctrl compatible
  2025-02-09 22:06 ` [PATCH 06/10] dt-bindings: mfd: syscon: Add Cvitek CV18xx rtcsys core and ctrl compatible Alexander Sverdlin
@ 2025-02-10  5:15   ` Inochi Amaoto
  2025-02-10  8:48   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 25+ messages in thread
From: Inochi Amaoto @ 2025-02-10  5:15 UTC (permalink / raw)
  To: Alexander Sverdlin, soc
  Cc: Chen Wang, Inochi Amaoto, linux-pm, linux-riscv, devicetree,
	Haylen Chu, linux-arm-kernel, Sebastian Reichel, Arnd Bergmann,
	Philipp Zabel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Lee Jones, Inochi Amaoto

On Sun, Feb 09, 2025 at 11:06:31PM +0100, Alexander Sverdlin wrote:
> These syscon blocks will be used for CV18xx reset driver.
> 
> Signed-off-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
> ---
>  Documentation/devicetree/bindings/mfd/syscon.yaml | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/mfd/syscon.yaml b/Documentation/devicetree/bindings/mfd/syscon.yaml
> index 4d67ff26d445..5a0b102d1bd9 100644
> --- a/Documentation/devicetree/bindings/mfd/syscon.yaml
> +++ b/Documentation/devicetree/bindings/mfd/syscon.yaml
> @@ -108,6 +108,8 @@ select:
>            - rockchip,rk3576-qos
>            - rockchip,rk3588-qos
>            - rockchip,rv1126-qos
> +          - sophgo,cv1800-rtcsys-core
> +          - sophgo,cv1800-rtcsys-ctrl
>            - st,spear1340-misc
>            - stericsson,nomadik-pmu
>            - starfive,jh7100-sysmain
> @@ -207,6 +209,8 @@ properties:
>            - rockchip,rk3576-qos
>            - rockchip,rk3588-qos
>            - rockchip,rv1126-qos
> +          - sophgo,cv1800-rtcsys-core
> +          - sophgo,cv1800-rtcsys-ctrl
>            - st,spear1340-misc
>            - stericsson,nomadik-pmu
>            - starfive,jh7100-sysmain
> -- 
> 2.48.1
> 

No cv1800, use cv1800b as the base one.

Regards,
Inochi

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

* Re: [PATCH 00/10] arm64 support for Milk-V Duo Module 01 EVB
  2025-02-09 22:06 [PATCH 00/10] arm64 support for Milk-V Duo Module 01 EVB Alexander Sverdlin
                   ` (4 preceding siblings ...)
  2025-02-10  0:02 ` [PATCH 00/10] arm64 support for Milk-V Duo Module 01 EVB Chen Wang
@ 2025-02-10  5:33 ` Inochi Amaoto
  2025-02-10 12:10   ` Alexander Sverdlin
  2025-02-10 20:55   ` Alexander Sverdlin
  2025-02-10 16:22 ` Rob Herring (Arm)
  6 siblings, 2 replies; 25+ messages in thread
From: Inochi Amaoto @ 2025-02-10  5:33 UTC (permalink / raw)
  To: Alexander Sverdlin, Yixun Lan
  Cc: soc, Chen Wang, Inochi Amaoto, Lee Jones, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Philipp Zabel, Catalin Marinas,
	Will Deacon, Arnd Bergmann, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Sebastian Reichel, devicetree, Haylen Chu,
	linux-arm-kernel, linux-riscv, linux-pm, Inochi Amaoto

> It would probably make sense that the whole series would go into SOC tree,
> even though technically nothing prevents the reboot/reset driver to come
> in PM/reset tree. If everything would come together, `reboot` command would
> work out of the box.
> 
> [1] https://milkv.io/docs/duo/getting-started/duo-module-01
> [2] https://github.com/milkv-duo/duo-buildroot-sdk-v2/releases/
> [3] https://github.com/sophgo/sophgo-doc/releases/download/sg2000-trm-v1.01/sg2000_trm_en.pdf
> 

This reboot implentment across the RTC and 8051 domain, which is
still a big problem to be upstreamed. This should be designed 
carefully and needs further discussion. Adding these two syscon
compatiable may be not a good idea and cause some problem. I invite
Yixun to this talk and he may give some useful suggestions.

At last, I prefer this goes to an separate patch series, and
implement with rtc device.

Regards,
Inochi

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

* Re: [PATCH 07/10] dt-bindings: reset: sophgo: Add CV18xx reset controller
  2025-02-09 22:06 ` [PATCH 07/10] dt-bindings: reset: sophgo: Add CV18xx reset controller Alexander Sverdlin
@ 2025-02-10  5:36   ` Inochi Amaoto
  2025-02-10  8:49   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 25+ messages in thread
From: Inochi Amaoto @ 2025-02-10  5:36 UTC (permalink / raw)
  To: Alexander Sverdlin, soc
  Cc: Chen Wang, Inochi Amaoto, linux-pm, linux-riscv, devicetree,
	Haylen Chu, linux-arm-kernel, Sebastian Reichel, Arnd Bergmann,
	Philipp Zabel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Lee Jones, Inochi Amaoto

On Sun, Feb 09, 2025 at 11:06:32PM +0100, Alexander Sverdlin wrote:
> Add DT bindings for CV18xx reset controller. The power/reboot driver is
> going to use only 4 bits from two different MMIO regions which can be
> potentially used by other subsystems/drivers, therefore the resources
> are not being claimed directly by the device/driver, but via syscons
> instead.
> 
> Link: https://github.com/sophgo/sophgo-doc/releases/download/sg2000-trm-v1.01/sg2000_trm_en.pdf
> Signed-off-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
> ---
>  .../bindings/reset/sophgo,cv1800-reset.yaml   | 38 +++++++++++++++++++
>  1 file changed, 38 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/reset/sophgo,cv1800-reset.yaml
> 
> diff --git a/Documentation/devicetree/bindings/reset/sophgo,cv1800-reset.yaml b/Documentation/devicetree/bindings/reset/sophgo,cv1800-reset.yaml
> new file mode 100644
> index 000000000000..4f058f99df5f
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/reset/sophgo,cv1800-reset.yaml
> @@ -0,0 +1,38 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/reset/sophgo,cv1800-reset.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Cvitek CV18xx/Sophgo SG2000 Reset Controller
> +
> +maintainers:
> +  - Alexander Sverdlin <alexander.sverdlin@gmail.com>
> +
> +properties:
> +  compatible:
> +    const: sophgo,cv1800-reset

Please use cv1800b, not cv1800. And this is a reboot device
not reset device. Refer other bindings to write yours.

Regards,
Inochi

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

* Re: [PATCH 06/10] dt-bindings: mfd: syscon: Add Cvitek CV18xx rtcsys core and ctrl compatible
  2025-02-09 22:06 ` [PATCH 06/10] dt-bindings: mfd: syscon: Add Cvitek CV18xx rtcsys core and ctrl compatible Alexander Sverdlin
  2025-02-10  5:15   ` Inochi Amaoto
@ 2025-02-10  8:48   ` Krzysztof Kozlowski
  2025-02-10 20:30     ` Alexander Sverdlin
  1 sibling, 1 reply; 25+ messages in thread
From: Krzysztof Kozlowski @ 2025-02-10  8:48 UTC (permalink / raw)
  To: Alexander Sverdlin, soc
  Cc: Chen Wang, Inochi Amaoto, linux-pm, linux-riscv, devicetree,
	Haylen Chu, linux-arm-kernel, Sebastian Reichel, Arnd Bergmann,
	Philipp Zabel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Lee Jones

On 09/02/2025 23:06, Alexander Sverdlin wrote:
> These syscon blocks will be used for CV18xx reset driver.


No, implement proper reset block instead of abusing syscon.

Best regards,
Krzysztof

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

* Re: [PATCH 07/10] dt-bindings: reset: sophgo: Add CV18xx reset controller
  2025-02-09 22:06 ` [PATCH 07/10] dt-bindings: reset: sophgo: Add CV18xx reset controller Alexander Sverdlin
  2025-02-10  5:36   ` Inochi Amaoto
@ 2025-02-10  8:49   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 25+ messages in thread
From: Krzysztof Kozlowski @ 2025-02-10  8:49 UTC (permalink / raw)
  To: Alexander Sverdlin, soc
  Cc: Chen Wang, Inochi Amaoto, linux-pm, linux-riscv, devicetree,
	Haylen Chu, linux-arm-kernel, Sebastian Reichel, Arnd Bergmann,
	Philipp Zabel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Lee Jones

On 09/02/2025 23:06, Alexander Sverdlin wrote:
> Add DT bindings for CV18xx reset controller. The power/reboot driver is
> going to use only 4 bits from two different MMIO regions which can be
> potentially used by other subsystems/drivers, therefore the resources
> are not being claimed directly by the device/driver, but via syscons
> instead.
> 
> Link: https://github.com/sophgo/sophgo-doc/releases/download/sg2000-trm-v1.01/sg2000_trm_en.pdf
> Signed-off-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
> ---
>  .../bindings/reset/sophgo,cv1800-reset.yaml   | 38 +++++++++++++++++++
>  1 file changed, 38 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/reset/sophgo,cv1800-reset.yaml
> 
> diff --git a/Documentation/devicetree/bindings/reset/sophgo,cv1800-reset.yaml b/Documentation/devicetree/bindings/reset/sophgo,cv1800-reset.yaml
> new file mode 100644
> index 000000000000..4f058f99df5f
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/reset/sophgo,cv1800-reset.yaml
> @@ -0,0 +1,38 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/reset/sophgo,cv1800-reset.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Cvitek CV18xx/Sophgo SG2000 Reset Controller
> +
> +maintainers:
> +  - Alexander Sverdlin <alexander.sverdlin@gmail.com>
> +
> +properties:
> +  compatible:
> +    const: sophgo,cv1800-reset
> +

Missing reset cells.

> +  sophgo,rtcsys-ctrl:
> +    description: phandle of the "RTCSYS_CTRL" syscon block
> +    $ref: /schemas/types.yaml#/definitions/phandle
> +
> +  sophgo,rtcsys-core:
> +    description: phandle of the "RTCSYS_CORE" syscon block
> +    $ref: /schemas/types.yaml#/definitions/phandle

This does not look right - entirely fake device. And your DTS next patch
proves it.

> +
> +required:
> +  - compatible
> +  - sophgo,rtcsys-ctrl
> +  - sophgo,rtcsys-core
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    soc-reset {

Node names should be generic. See also an explanation and list of
examples (not exhaustive) in DT specification:
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation


> +        compatible = "sophgo,cv1800-reset";
> +        sophgo,rtcsys-ctrl = <&rtcsys_ctrl>;
> +        sophgo,rtcsys-core = <&rtcsys_core>;
> +    };
> +...


Best regards,
Krzysztof

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

* Re: [PATCH 08/10] riscv/arm64: dts: cv18xx: Add sysctl and reset nodes
  2025-02-09 22:06 ` [PATCH 08/10] riscv/arm64: dts: cv18xx: Add sysctl and reset nodes Alexander Sverdlin
  2025-02-10  5:13   ` Inochi Amaoto
@ 2025-02-10  8:51   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 25+ messages in thread
From: Krzysztof Kozlowski @ 2025-02-10  8:51 UTC (permalink / raw)
  To: Alexander Sverdlin, soc
  Cc: Chen Wang, Inochi Amaoto, linux-pm, linux-riscv, devicetree,
	Haylen Chu, linux-arm-kernel, Sebastian Reichel, Arnd Bergmann,
	Philipp Zabel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Lee Jones

On 09/02/2025 23:06, Alexander Sverdlin wrote:
> Add reset controller node and required sysctl nodes.
> 
> Signed-off-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
> ---
>  arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi b/arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi
> index 53834b0658b2..d793b6db4ed1 100644
> --- a/arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi
> +++ b/arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi
> @@ -309,5 +309,21 @@ dmac: dma-controller@4330000 {
>  			snps,data-width = <4>;
>  			status = "disabled";
>  		};
> +
> +		rtcsys_ctrl: syscon@5025000 {
> +			compatible = "sophgo,cv1800-rtcsys-ctrl", "syscon";
> +			reg = <0x05025000 0x1000>;
> +		};
> +
> +		rtcsys_core: syscon@5026000 {
> +			compatible = "sophgo,cv1800-rtcsys-core", "syscon";
> +			reg = <0x05026000 0x1000>;
> +		};
> +
> +		soc-reset {
> +			compatible = "sophgo,cv1800-reset";

Nope. You cannot have non-MMIO nodes in SoC which proves this is not a
real SoC device. Neither compatible, nor its placement is correct.

Depending on the hardware design, this most likely is just part of your
5025000 block.


Best regards,
Krzysztof

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

* Re: [PATCH 09/10] power: reset: cv18xx: New driver
  2025-02-09 22:06 ` [PATCH 09/10] power: reset: cv18xx: New driver Alexander Sverdlin
@ 2025-02-10  8:52   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 25+ messages in thread
From: Krzysztof Kozlowski @ 2025-02-10  8:52 UTC (permalink / raw)
  To: Alexander Sverdlin, soc
  Cc: Chen Wang, Inochi Amaoto, linux-pm, linux-riscv, Haylen Chu,
	linux-arm-kernel, Sebastian Reichel, Arnd Bergmann, Philipp Zabel,
	Lee Jones

On 09/02/2025 23:06, Alexander Sverdlin wrote:
> +
> +static int cv18xx_reset_probe(struct platform_device *pdev)
> +{
> +	struct device *dev = &pdev->dev;
> +	struct device_node *np = dev->of_node;
> +	int ret;
> +
> +	if (!np)
> +		return -ENODEV;
> +
> +	rtcsys_ctrl_regs = syscon_regmap_lookup_by_phandle(np, "sophgo,rtcsys-ctrl");
> +	if (IS_ERR(rtcsys_ctrl_regs))
> +		return dev_err_probe(dev, PTR_ERR(rtcsys_ctrl_regs),
> +				     "sophgo,rtcsys-ctrl lookup failed\n");
> +
> +	rtcsys_core_regs = syscon_regmap_lookup_by_phandle(np, "sophgo,rtcsys-core");
> +	if (IS_ERR(rtcsys_core_regs))
> +		return dev_err_probe(dev, PTR_ERR(rtcsys_core_regs),
> +				     "sophgo,rtcsys-core lookup failed\n");
> +
> +	ret = devm_register_restart_handler(&pdev->dev, cv18xx_restart_handler, NULL);
> +	if (ret)
> +		dev_err(&pdev->dev, "Cannot register restart handler (%pe)\n", ERR_PTR(ret));

You called it reset driver and placed it in reset, but this is reboot
handler?

> +	return ret;
> +}
> +
> +static const struct of_device_id cv18xx_reset_of_match[] = {
> +	{ .compatible = "sophgo,cv1800-reset" },
> +	{}
> +};
> +MODULE_DEVICE_TABLE(platform, cv18xx_reset_of_match);
> +
> +static struct platform_driver cv18xx_reset_driver = {
> +	.probe = cv18xx_reset_probe,
> +	.driver = {
> +		.name = "cv18xx-reset",
> +		.of_match_table = cv18xx_reset_of_match,
> +	},
> +};
> +module_platform_driver(cv18xx_reset_driver);
> +
> +MODULE_AUTHOR("Alexander Sverdlin <alexander.sverdlin@gmail.com>");
> +MODULE_DESCRIPTION("Cvitek CV18xx/Sophgo SG2000 Reset Driver");
> +MODULE_ALIAS("platform:cv18xx-reset");

You should not need MODULE_ALIAS() in normal cases. If you need it,
usually it means your device ID table is wrong (e.g. misses either
entries or MODULE_DEVICE_TABLE()). MODULE_ALIAS() is not a substitute
for incomplete ID table.




Best regards,
Krzysztof

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

* Re: [PATCH 08/10] riscv/arm64: dts: cv18xx: Add sysctl and reset nodes
  2025-02-10  5:13   ` Inochi Amaoto
@ 2025-02-10 11:47     ` Alexander Sverdlin
  2025-02-10 12:29       ` Inochi Amaoto
  0 siblings, 1 reply; 25+ messages in thread
From: Alexander Sverdlin @ 2025-02-10 11:47 UTC (permalink / raw)
  To: Inochi Amaoto, soc
  Cc: Chen Wang, Inochi Amaoto, linux-pm, linux-riscv, devicetree,
	Haylen Chu, linux-arm-kernel, Sebastian Reichel, Arnd Bergmann,
	Philipp Zabel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Lee Jones

Thanks for quick feedback Inochi!

On Mon, 2025-02-10 at 13:13 +0800, Inochi Amaoto wrote:
> On Sun, Feb 09, 2025 at 11:06:33PM +0100, Alexander Sverdlin wrote:
> > Add reset controller node and required sysctl nodes.
> > 
> > Signed-off-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
> > ---
> >   arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi | 16 ++++++++++++++++
> >   1 file changed, 16 insertions(+)
> > 
> > diff --git a/arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi b/arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi
> > index 53834b0658b2..d793b6db4ed1 100644
> > --- a/arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi
> > +++ b/arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi
> > @@ -309,5 +309,21 @@ dmac: dma-controller@4330000 {
> >   			snps,data-width = <4>;
> >   			status = "disabled";
> >   		};
> > +
> 
> > +		rtcsys_ctrl: syscon@5025000 {
> > +			compatible = "sophgo,cv1800-rtcsys-ctrl", "syscon";
> > +			reg = <0x05025000 0x1000>;
> > +		};
> > +
> > +		rtcsys_core: syscon@5026000 {
> > +			compatible = "sophgo,cv1800-rtcsys-core", "syscon";
> > +			reg = <0x05026000 0x1000>;
> > +		};
> > +
> > +		soc-reset {
> > +			compatible = "sophgo,cv1800-reset";
> > +			sophgo,rtcsys-ctrl = <&rtcsys_ctrl>;
> > +			sophgo,rtcsys-core = <&rtcsys_core>;
> > +		};
> 
> I think these node is not suitable for riscv. It should use SBI SRST
> extension to restart.

Independent from the particular form, or its correctness, this is still HW
description, right? It would be a "policy" for the kernel configuration, if
the particular build would rely on the FW or a kernel driver to reboot.

In other words, the HW block remains in place, no matter if it's controlled
by a kernel module or a FW. What the point in hiding it from the RiscV part
of DT, keeping on ARM64 side only?

-- 
Alexander Sverdlin.


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

* Re: [PATCH 00/10] arm64 support for Milk-V Duo Module 01 EVB
  2025-02-10  5:33 ` Inochi Amaoto
@ 2025-02-10 12:10   ` Alexander Sverdlin
  2025-02-10 20:55   ` Alexander Sverdlin
  1 sibling, 0 replies; 25+ messages in thread
From: Alexander Sverdlin @ 2025-02-10 12:10 UTC (permalink / raw)
  To: Inochi Amaoto, Yixun Lan
  Cc: soc, Chen Wang, Inochi Amaoto, Lee Jones, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Philipp Zabel, Catalin Marinas,
	Will Deacon, Arnd Bergmann, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Sebastian Reichel, devicetree, Haylen Chu,
	linux-arm-kernel, linux-riscv, linux-pm

Thanks for quick feedback Inochi!

On Mon, 2025-02-10 at 13:33 +0800, Inochi Amaoto wrote:
> > It would probably make sense that the whole series would go into SOC tree,
> > even though technically nothing prevents the reboot/reset driver to come
> > in PM/reset tree. If everything would come together, `reboot` command would
> > work out of the box.
> > 
> > [1] https://milkv.io/docs/duo/getting-started/duo-module-01
> > [2] https://github.com/milkv-duo/duo-buildroot-sdk-v2/releases/
> > [3] https://github.com/sophgo/sophgo-doc/releases/download/sg2000-trm-v1.01/sg2000_trm_en.pdf
> > 
> 
> This reboot implentment across the RTC and 8051 domain, which is
> still a big problem to be upstreamed. This should be designed 

Could you please elaborate on the "big problem"?
Does the binary-distributed ATF perform some other type of reset in WARM case?
(COLD is just mirorred based on TRM).

> carefully and needs further discussion. Adding these two syscon
> compatiable may be not a good idea and cause some problem. I invite
> Yixun to this talk and he may give some useful suggestions.
> 
> At last, I prefer this goes to an separate patch series, and
> implement with rtc device.

Sure, I can split the reboot story from the series...

-- 
Alexander Sverdlin.


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

* Re: [PATCH 08/10] riscv/arm64: dts: cv18xx: Add sysctl and reset nodes
  2025-02-10 11:47     ` Alexander Sverdlin
@ 2025-02-10 12:29       ` Inochi Amaoto
  0 siblings, 0 replies; 25+ messages in thread
From: Inochi Amaoto @ 2025-02-10 12:29 UTC (permalink / raw)
  To: Alexander Sverdlin, Inochi Amaoto, soc
  Cc: Chen Wang, Inochi Amaoto, linux-pm, linux-riscv, devicetree,
	Haylen Chu, linux-arm-kernel, Sebastian Reichel, Arnd Bergmann,
	Philipp Zabel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Lee Jones

On Mon, Feb 10, 2025 at 12:47:59PM +0100, Alexander Sverdlin wrote:
> Thanks for quick feedback Inochi!
> 
> On Mon, 2025-02-10 at 13:13 +0800, Inochi Amaoto wrote:
> > On Sun, Feb 09, 2025 at 11:06:33PM +0100, Alexander Sverdlin wrote:
> > > Add reset controller node and required sysctl nodes.
> > > 
> > > Signed-off-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
> > > ---
> > >   arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi | 16 ++++++++++++++++
> > >   1 file changed, 16 insertions(+)
> > > 
> > > diff --git a/arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi b/arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi
> > > index 53834b0658b2..d793b6db4ed1 100644
> > > --- a/arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi
> > > +++ b/arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi
> > > @@ -309,5 +309,21 @@ dmac: dma-controller@4330000 {
> > >   			snps,data-width = <4>;
> > >   			status = "disabled";
> > >   		};
> > > +
> > 
> > > +		rtcsys_ctrl: syscon@5025000 {
> > > +			compatible = "sophgo,cv1800-rtcsys-ctrl", "syscon";
> > > +			reg = <0x05025000 0x1000>;
> > > +		};
> > > +
> > > +		rtcsys_core: syscon@5026000 {
> > > +			compatible = "sophgo,cv1800-rtcsys-core", "syscon";
> > > +			reg = <0x05026000 0x1000>;
> > > +		};
> > > +
> > > +		soc-reset {
> > > +			compatible = "sophgo,cv1800-reset";
> > > +			sophgo,rtcsys-ctrl = <&rtcsys_ctrl>;
> > > +			sophgo,rtcsys-core = <&rtcsys_core>;
> > > +		};
> > 
> > I think these node is not suitable for riscv. It should use SBI SRST
> > extension to restart.
> 
> Independent from the particular form, or its correctness, this is still HW
> description, right? It would be a "policy" for the kernel configuration, if
> the particular build would rely on the FW or a kernel driver to reboot.
> 
> In other words, the HW block remains in place, no matter if it's controlled
> by a kernel module or a FW. What the point in hiding it from the RiscV part
> of DT, keeping on ARM64 side only?
> 

Yeah, I have make a mistake, the device is needed. SBI need these
device definition to handle some power event.

Regards,
Inochi

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

* Re: [PATCH 00/10] arm64 support for Milk-V Duo Module 01 EVB
  2025-02-09 22:06 [PATCH 00/10] arm64 support for Milk-V Duo Module 01 EVB Alexander Sverdlin
                   ` (5 preceding siblings ...)
  2025-02-10  5:33 ` Inochi Amaoto
@ 2025-02-10 16:22 ` Rob Herring (Arm)
  6 siblings, 0 replies; 25+ messages in thread
From: Rob Herring (Arm) @ 2025-02-10 16:22 UTC (permalink / raw)
  To: Alexander Sverdlin
  Cc: Chen Wang, linux-arm-kernel, Sebastian Reichel, Conor Dooley,
	devicetree, Haylen Chu, linux-pm, Krzysztof Kozlowski, soc,
	Arnd Bergmann, Will Deacon, Albert Ou, Inochi Amaoto,
	Palmer Dabbelt, linux-riscv, Paul Walmsley, Philipp Zabel,
	Catalin Marinas, Lee Jones


On Sun, 09 Feb 2025 23:06:25 +0100, Alexander Sverdlin wrote:
> This series adds very basic support for Milk-V Duo Module 01 EVB [1] in
> arm64 mode. The SoC (SG2000) is dual-arch, RiscV and ARM64, the latter has
> been chosen because the upstream toolchain can be utilized.
> 
> Sophgo SG2000 seems to be a continuation of the Cvitek CV18xx series, same
> peripherals with an addition of ARM64 core. Therefore it would be
> beneficial not to copy-paste the peripherals' device-tree, but rather split
> the most suitable riscv DT into ARCH-specific and peripherals parts and
> just include the latter on the arm64 side.
> 
> This series adds the device-tree for Milk-V Duo Module 01 EVB, which
> in turn contains Milk-V Duo Module 01 (separate .dtsi) on it, which has
> SG2000 SoC inside (separate .dtsi).
> 
> This series has been tested with Sophgo-provided U-Boot binary [2]: it
> boots from SD card, pinctrl, serial, GPIO drivers are functional (same
> as for RiscV-based CV18xx SoCs).
> New reset driver is provided as an alternative to the ATF PSCI handler,
> which Sophgo only provides in binary form.
> 
> Partial SoC documentation is available [3].
> 
> This series lacks the support of:
> - USB
> - Audio
> - Ethernet
> - WiFi
> - Bluetooth
> - eMMC
> - Video
> 
> It would probably make sense that the whole series would go into SOC tree,
> even though technically nothing prevents the reboot/reset driver to come
> in PM/reset tree. If everything would come together, `reboot` command would
> work out of the box.
> 
> [1] https://milkv.io/docs/duo/getting-started/duo-module-01
> [2] https://github.com/milkv-duo/duo-buildroot-sdk-v2/releases/
> [3] https://github.com/sophgo/sophgo-doc/releases/download/sg2000-trm-v1.01/sg2000_trm_en.pdf
> 
> Alexander Sverdlin (10):
>   arm64: Add SOPHGO SOC family Kconfig support
>   riscv: dts: sophgo: cv18xx: Split into CPU core and peripheral parts
>   arm64: dts: sophgo: Add initial SG2000 SoC device tree
>   arm64: dts: sophgo: Add Duo Module 01
>   arm64: dts: sophgo: Add Duo Module 01 Evaluation Board
>   dt-bindings: mfd: syscon: Add Cvitek CV18xx rtcsys core and ctrl
>     compatible
>   dt-bindings: reset: sophgo: Add CV18xx reset controller
>   riscv/arm64: dts: cv18xx: Add sysctl and reset nodes
>   power: reset: cv18xx: New driver
>   arm64: defconfig: Enable rudimentary Sophgo SG2000 support
> 
>  .../devicetree/bindings/mfd/syscon.yaml       |   4 +
>  .../bindings/reset/sophgo,cv1800-reset.yaml   |  38 ++
>  MAINTAINERS                                   |   1 +
>  arch/arm64/Kconfig.platforms                  |  12 +
>  arch/arm64/boot/dts/Makefile                  |   1 +
>  arch/arm64/boot/dts/sophgo/Makefile           |   2 +
>  arch/arm64/boot/dts/sophgo/sg2000.dtsi        |  79 +++++
>  .../sophgo/sg2000_milkv_duo_module_01.dtsi    |  84 +++++
>  .../sophgo/sg2000_milkv_duo_module_01_evb.dts |  30 ++
>  arch/arm64/configs/defconfig                  |   3 +
>  arch/riscv/boot/dts/sophgo/cv181x.dtsi        |   2 +-
>  arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi | 329 ++++++++++++++++++
>  arch/riscv/boot/dts/sophgo/cv18xx.dtsi        | 305 +---------------
>  drivers/power/reset/Kconfig                   |  12 +
>  drivers/power/reset/Makefile                  |   1 +
>  drivers/power/reset/cv18xx-reset.c            |  89 +++++
>  16 files changed, 689 insertions(+), 303 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/reset/sophgo,cv1800-reset.yaml
>  create mode 100644 arch/arm64/boot/dts/sophgo/Makefile
>  create mode 100644 arch/arm64/boot/dts/sophgo/sg2000.dtsi
>  create mode 100644 arch/arm64/boot/dts/sophgo/sg2000_milkv_duo_module_01.dtsi
>  create mode 100644 arch/arm64/boot/dts/sophgo/sg2000_milkv_duo_module_01_evb.dts
>  create mode 100644 arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi
>  create mode 100644 drivers/power/reset/cv18xx-reset.c
> 
> --
> 2.48.1
> 
> 
> 


My bot found new DTB warnings on the .dts files added or changed in this
series.

Some warnings may be from an existing SoC .dtsi. Or perhaps the warnings
are fixed by another series. Ultimately, it is up to the platform
maintainer whether these warnings are acceptable or not. No need to reply
unless the platform maintainer has comments.

If you already ran DT checks and didn't see these error(s), then
make sure dt-schema is up to date:

  pip3 install dtschema --upgrade


New warnings running 'make CHECK_DTBS=y for arch/arm64/boot/dts/sophgo/' for 20250209220646.1090868-1-alexander.sverdlin@gmail.com:

arch/arm64/boot/dts/sophgo/sg2000_milkv_duo_module_01_evb.dtb: /: failed to match any schema with compatible: ['sophgo,sg2000']
arch/arm64/boot/dts/sophgo/sg2000_milkv_duo_module_01_evb.dtb: soc: soc-reset: 'ranges' is a required property
	from schema $id: http://devicetree.org/schemas/simple-bus.yaml#
arch/arm64/boot/dts/sophgo/sg2000_milkv_duo_module_01_evb.dtb: l2-cache: 'cache-unified' is a dependency of 'cache-size'
	from schema $id: http://devicetree.org/schemas/cache.yaml#
arch/arm64/boot/dts/sophgo/sg2000_milkv_duo_module_01_evb.dtb: l2-cache: 'cache-unified' is a required property
	from schema $id: http://devicetree.org/schemas/cache.yaml#
arch/arm64/boot/dts/sophgo/sg2000_milkv_duo_module_01_evb.dtb: l2-cache: Unevaluated properties are not allowed ('cache-level', 'cache-size' were unexpected)
	from schema $id: http://devicetree.org/schemas/cache.yaml#






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

* Re: [PATCH 06/10] dt-bindings: mfd: syscon: Add Cvitek CV18xx rtcsys core and ctrl compatible
  2025-02-10  8:48   ` Krzysztof Kozlowski
@ 2025-02-10 20:30     ` Alexander Sverdlin
  2025-02-10 20:40       ` Alexander Sverdlin
  0 siblings, 1 reply; 25+ messages in thread
From: Alexander Sverdlin @ 2025-02-10 20:30 UTC (permalink / raw)
  To: Krzysztof Kozlowski, soc
  Cc: Chen Wang, Inochi Amaoto, linux-pm, linux-riscv, devicetree,
	Haylen Chu, linux-arm-kernel, Sebastian Reichel, Arnd Bergmann,
	Philipp Zabel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Lee Jones

Hi Krzysztof!

On Mon, 2025-02-10 at 09:48 +0100, Krzysztof Kozlowski wrote:
> On 09/02/2025 23:06, Alexander Sverdlin wrote:
> > These syscon blocks will be used for CV18xx reset driver.
> 
> 
> No, implement proper reset block instead of abusing syscon.

I don't think it's an abuse... You need to look into the corresponding TRM [1].

4 bits I need to tweak (and one magic number into unlock register) are randomly
placed at random memory adresses and otherwise adjacent bits have random
unrelated functions from random unrelated subsystems.
If it's not syscon, I don't know what it is.

It has a reset HW block, as you and Inochi have correctly pointed out, for other
purposes, for resetting the SoC IP blocks. The overall SoC reset is complete
mamba jamba.

I was thinking now about a syscon driver, which will register_restart_handler()...

Inochi, do you have more insights into it? You've mentioned RTC and 8051...
Looking into TRM I don't get it, why a thing blessed to do all the housekeeping
(and called "System Controller" in imx8, for instance) happen to have RTC_ prefix...
Would RTC subsystem maintainer be happy with a monster driver which has ties
to all other subsystems?

[1] https://github.com/sophgo/sophgo-doc/releases/download/sg2000-trm-v1.01/sg2000_trm_en.pdf
("rtc_ctrl_unlockkey", "rtc_ctrl0", "RTC_EN_WARM_RST_REQ", "RTC_EN_PWR_CYC_REQ").

-- 
Alexander Sverdlin.


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

* Re: [PATCH 06/10] dt-bindings: mfd: syscon: Add Cvitek CV18xx rtcsys core and ctrl compatible
  2025-02-10 20:30     ` Alexander Sverdlin
@ 2025-02-10 20:40       ` Alexander Sverdlin
  0 siblings, 0 replies; 25+ messages in thread
From: Alexander Sverdlin @ 2025-02-10 20:40 UTC (permalink / raw)
  To: Krzysztof Kozlowski, soc
  Cc: Chen Wang, Inochi Amaoto, linux-pm, linux-riscv, devicetree,
	Haylen Chu, linux-arm-kernel, Sebastian Reichel, Arnd Bergmann,
	Philipp Zabel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Lee Jones

On Mon, 2025-02-10 at 21:30 +0100, Alexander Sverdlin wrote:
> On Mon, 2025-02-10 at 09:48 +0100, Krzysztof Kozlowski wrote:
> > On 09/02/2025 23:06, Alexander Sverdlin wrote:
> > > These syscon blocks will be used for CV18xx reset driver.
> > 
> > 
> > No, implement proper reset block instead of abusing syscon.
> 
> I don't think it's an abuse... You need to look into the corresponding TRM [1].
> 
> 4 bits I need to tweak (and one magic number into unlock register) are randomly
> placed at random memory adresses and otherwise adjacent bits have random
> unrelated functions from random unrelated subsystems.
> If it's not syscon, I don't know what it is.
> 
> It has a reset HW block, as you and Inochi have correctly pointed out, for other
> purposes, for resetting the SoC IP blocks. The overall SoC reset is complete
> mamba jamba.
> 
> I was thinking now about a syscon driver, which will register_restart_handler()...

Sorry, I meant "MFD" driver...

> Inochi, do you have more insights into it? You've mentioned RTC and 8051...
> Looking into TRM I don't get it, why a thing blessed to do all the housekeeping
> (and called "System Controller" in imx8, for instance) happen to have RTC_ prefix...
> Would RTC subsystem maintainer be happy with a monster driver which has ties
> to all other subsystems?
> 
> [1] https://github.com/sophgo/sophgo-doc/releases/download/sg2000-trm-v1.01/sg2000_trm_en.pdf
> ("rtc_ctrl_unlockkey", "rtc_ctrl0", "RTC_EN_WARM_RST_REQ", "RTC_EN_PWR_CYC_REQ").

-- 
Alexander Sverdlin.


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

* Re: [PATCH 00/10] arm64 support for Milk-V Duo Module 01 EVB
  2025-02-10  5:33 ` Inochi Amaoto
  2025-02-10 12:10   ` Alexander Sverdlin
@ 2025-02-10 20:55   ` Alexander Sverdlin
  2025-02-11 19:37     ` Alexander Sverdlin
  1 sibling, 1 reply; 25+ messages in thread
From: Alexander Sverdlin @ 2025-02-10 20:55 UTC (permalink / raw)
  To: Inochi Amaoto, Yixun Lan
  Cc: soc, Chen Wang, Inochi Amaoto, Lee Jones, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Philipp Zabel, Catalin Marinas,
	Will Deacon, Arnd Bergmann, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Sebastian Reichel, devicetree, Haylen Chu,
	linux-arm-kernel, linux-riscv, linux-pm

Hi Inochi!

On Mon, 2025-02-10 at 13:33 +0800, Inochi Amaoto wrote:
> > It would probably make sense that the whole series would go into SOC tree,
> > even though technically nothing prevents the reboot/reset driver to come
> > in PM/reset tree. If everything would come together, `reboot` command would
> > work out of the box.
> > 
> > [1] https://milkv.io/docs/duo/getting-started/duo-module-01
> > [2] https://github.com/milkv-duo/duo-buildroot-sdk-v2/releases/
> > [3] https://github.com/sophgo/sophgo-doc/releases/download/sg2000-trm-v1.01/sg2000_trm_en.pdf
> > 
> 
> This reboot implentment across the RTC and 8051 domain, which is
> still a big problem to be upstreamed. This should be designed 

Now I've got it. The problem is not in the reboot procedure, but
rather how to model this thing in the DT, because of all these
unrelated functions brought into two HW address spaces...

> carefully and needs further discussion. Adding these two syscon
> compatiable may be not a good idea and cause some problem. I invite
> Yixun to this talk and he may give some useful suggestions.
> 
> At last, I prefer this goes to an separate patch series, and
> implement with rtc device.

-- 
Alexander Sverdlin.


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

* Re: [PATCH 00/10] arm64 support for Milk-V Duo Module 01 EVB
  2025-02-10 20:55   ` Alexander Sverdlin
@ 2025-02-11 19:37     ` Alexander Sverdlin
  2025-02-12  0:29       ` Inochi Amaoto
  0 siblings, 1 reply; 25+ messages in thread
From: Alexander Sverdlin @ 2025-02-11 19:37 UTC (permalink / raw)
  To: Inochi Amaoto, Yixun Lan
  Cc: soc, Chen Wang, Inochi Amaoto, Lee Jones, Krzysztof Kozlowski,
	devicetree, Haylen Chu, linux-arm-kernel, linux-riscv, linux-pm

Hi Inochi!

On Mon, 2025-02-10 at 21:55 +0100, Alexander Sverdlin wrote:
> > > It would probably make sense that the whole series would go into SOC tree,
> > > even though technically nothing prevents the reboot/reset driver to come
> > > in PM/reset tree. If everything would come together, `reboot` command would
> > > work out of the box.
> > > 
> > > [1] https://milkv.io/docs/duo/getting-started/duo-module-01
> > > [2] https://github.com/milkv-duo/duo-buildroot-sdk-v2/releases/
> > > [3] https://github.com/sophgo/sophgo-doc/releases/download/sg2000-trm-v1.01/sg2000_trm_en.pdf
> > > 
> > 
> > This reboot implentment across the RTC and 8051 domain, which is
> > still a big problem to be upstreamed. This should be designed 
> 
> Now I've got it. The problem is not in the reboot procedure, but
> rather how to model this thing in the DT, because of all these
> unrelated functions brought into two HW address spaces...
> 
> > carefully and needs further discussion. Adding these two syscon
> > compatiable may be not a good idea and cause some problem. I invite
> > Yixun to this talk and he may give some useful suggestions.
> > 
> > At last, I prefer this goes to an separate patch series, and
> > implement with rtc device.

Thanks for your hints!
I've completely missed the RTC driver in progress [1].
I will provide a patch registering the reboot handler on top of the driver
as soon as it's accepted.

[1] https://patchwork.ozlabs.org/project/rtc-linux/patch/20240428060848.706573-3-qiujingbao.dlmu@gmail.com/

-- 
Alexander Sverdlin.


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

* Re: [PATCH 00/10] arm64 support for Milk-V Duo Module 01 EVB
  2025-02-11 19:37     ` Alexander Sverdlin
@ 2025-02-12  0:29       ` Inochi Amaoto
  2025-02-12  9:33         ` Alexander Sverdlin
  0 siblings, 1 reply; 25+ messages in thread
From: Inochi Amaoto @ 2025-02-12  0:29 UTC (permalink / raw)
  To: Alexander Sverdlin, Inochi Amaoto, Yixun Lan
  Cc: soc, Chen Wang, Inochi Amaoto, Lee Jones, Krzysztof Kozlowski,
	devicetree, Haylen Chu, linux-arm-kernel, linux-riscv, linux-pm

On Tue, Feb 11, 2025 at 08:37:01PM +0100, Alexander Sverdlin wrote:
> Hi Inochi!
> 
> On Mon, 2025-02-10 at 21:55 +0100, Alexander Sverdlin wrote:
> > > > It would probably make sense that the whole series would go into SOC tree,
> > > > even though technically nothing prevents the reboot/reset driver to come
> > > > in PM/reset tree. If everything would come together, `reboot` command would
> > > > work out of the box.
> > > > 
> > > > [1] https://milkv.io/docs/duo/getting-started/duo-module-01
> > > > [2] https://github.com/milkv-duo/duo-buildroot-sdk-v2/releases/
> > > > [3] https://github.com/sophgo/sophgo-doc/releases/download/sg2000-trm-v1.01/sg2000_trm_en.pdf
> > > > 
> > > 
> > > This reboot implentment across the RTC and 8051 domain, which is
> > > still a big problem to be upstreamed. This should be designed 
> > 
> > Now I've got it. The problem is not in the reboot procedure, but
> > rather how to model this thing in the DT, because of all these
> > unrelated functions brought into two HW address spaces...
> > 
> > > carefully and needs further discussion. Adding these two syscon
> > > compatiable may be not a good idea and cause some problem. I invite
> > > Yixun to this talk and he may give some useful suggestions.
> > > 
> > > At last, I prefer this goes to an separate patch series, and
> > > implement with rtc device.
> 
> Thanks for your hints!
> I've completely missed the RTC driver in progress [1].
> I will provide a patch registering the reboot handler on top of the driver
> as soon as it's accepted.
> 
> [1] https://patchwork.ozlabs.org/project/rtc-linux/patch/20240428060848.706573-3-qiujingbao.dlmu@gmail.com/
> 

As far as I know the RTC patch is no longer maintained. Maybe you can
pick it up?
The patch states can be found on:
https://github.com/sophgo/linux/wiki

Regards,
Inochi

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

* Re: [PATCH 00/10] arm64 support for Milk-V Duo Module 01 EVB
  2025-02-12  0:29       ` Inochi Amaoto
@ 2025-02-12  9:33         ` Alexander Sverdlin
  0 siblings, 0 replies; 25+ messages in thread
From: Alexander Sverdlin @ 2025-02-12  9:33 UTC (permalink / raw)
  To: Inochi Amaoto, Yixun Lan
  Cc: soc, Chen Wang, Inochi Amaoto, Lee Jones, Krzysztof Kozlowski,
	devicetree, Haylen Chu, linux-arm-kernel, linux-riscv, linux-pm

Hi Inochi!

On Wed, 2025-02-12 at 08:29 +0800, Inochi Amaoto wrote:
> > Thanks for your hints!
> > I've completely missed the RTC driver in progress [1].
> > I will provide a patch registering the reboot handler on top of the driver
> > as soon as it's accepted.
> > 
> > [1] https://patchwork.ozlabs.org/project/rtc-linux/patch/20240428060848.706573-3-qiujingbao.dlmu@gmail.com/
> > 
> 
> As far as I know the RTC patch is no longer maintained. Maybe you can
> pick it up?

I can try... If only I can make it work...

> The patch states can be found on:
> https://github.com/sophgo/linux/wiki

Thanks for the link!

-- 
Alexander Sverdlin.


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

end of thread, other threads:[~2025-02-12  9:33 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-09 22:06 [PATCH 00/10] arm64 support for Milk-V Duo Module 01 EVB Alexander Sverdlin
2025-02-09 22:06 ` [PATCH 06/10] dt-bindings: mfd: syscon: Add Cvitek CV18xx rtcsys core and ctrl compatible Alexander Sverdlin
2025-02-10  5:15   ` Inochi Amaoto
2025-02-10  8:48   ` Krzysztof Kozlowski
2025-02-10 20:30     ` Alexander Sverdlin
2025-02-10 20:40       ` Alexander Sverdlin
2025-02-09 22:06 ` [PATCH 07/10] dt-bindings: reset: sophgo: Add CV18xx reset controller Alexander Sverdlin
2025-02-10  5:36   ` Inochi Amaoto
2025-02-10  8:49   ` Krzysztof Kozlowski
2025-02-09 22:06 ` [PATCH 08/10] riscv/arm64: dts: cv18xx: Add sysctl and reset nodes Alexander Sverdlin
2025-02-10  5:13   ` Inochi Amaoto
2025-02-10 11:47     ` Alexander Sverdlin
2025-02-10 12:29       ` Inochi Amaoto
2025-02-10  8:51   ` Krzysztof Kozlowski
2025-02-09 22:06 ` [PATCH 09/10] power: reset: cv18xx: New driver Alexander Sverdlin
2025-02-10  8:52   ` Krzysztof Kozlowski
2025-02-10  0:02 ` [PATCH 00/10] arm64 support for Milk-V Duo Module 01 EVB Chen Wang
2025-02-10  5:15   ` Inochi Amaoto
2025-02-10  5:33 ` Inochi Amaoto
2025-02-10 12:10   ` Alexander Sverdlin
2025-02-10 20:55   ` Alexander Sverdlin
2025-02-11 19:37     ` Alexander Sverdlin
2025-02-12  0:29       ` Inochi Amaoto
2025-02-12  9:33         ` Alexander Sverdlin
2025-02-10 16:22 ` Rob Herring (Arm)

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