* [PATCH 0/2] remoteproc: cv1800b: Add initial support for C906L processor
@ 2025-06-08 2:37 Junhui Liu
2025-06-08 2:37 ` [PATCH 1/2] dt-bindings: remoteproc: Add C906L rproc for Sophgo CV1800B SoC Junhui Liu
2025-06-08 2:37 ` [PATCH 2/2] drivers: remoteproc: Add C906L controller " Junhui Liu
0 siblings, 2 replies; 11+ messages in thread
From: Junhui Liu @ 2025-06-08 2:37 UTC (permalink / raw)
To: Bjorn Andersson, Mathieu Poirier, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Chen Wang, Inochi Amaoto,
Junhui Liu, Philipp Zabel, Paul Walmsley, Palmer Dabbelt,
Albert Ou, Alexandre Ghiti
Cc: linux-remoteproc, devicetree, sophgo, linux-kernel, linux-riscv
This patch series introduces initial support for the C906L remote
processor in the Sophgo CV1800B SoC. The CV1800B SoC integrates multiple
cores, including a main application core running Linux, a C906L core
typically running RTOS, and an 8051 MCU.
The C906L is an asymmetric processor designed to typically run RTOS.
This patch adds the basic infrastructure to support remoteproc
management of the C906L processor, including firmware loading and basic
control (start/stop) from the main Linux core. Mailbox-related
functionality will be added in a separate patch.
The C906L remoteproc relies on the reset controller [1] to function
correctly.
A branch for testing is available at [2].
Link: https://lore.kernel.org/all/20250209122936.2338821-1-inochiama@gmail.com/ [1]
Link: https://github.com/pigmoral/linux/tree/cv1800-rproc-test [2]
---
Junhui Liu (2):
dt-bindings: remoteproc: Add C906L rproc for Sophgo CV1800B SoC
drivers: remoteproc: Add C906L controller for Sophgo CV1800B SoC
.../bindings/remoteproc/sophgo,cv1800b-c906l.yaml | 68 ++++++
drivers/remoteproc/Kconfig | 9 +
drivers/remoteproc/Makefile | 1 +
drivers/remoteproc/sophgo_cv1800b_c906l.c | 233 +++++++++++++++++++++
4 files changed, 311 insertions(+)
---
base-commit: 8630c59e99363c4b655788fd01134aef9bcd9264
change-id: 20250527-cv1800-rproc-08b3a9d2e461
Best regards,
--
Junhui Liu <junhui.liu@pigmoral.tech>
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 1/2] dt-bindings: remoteproc: Add C906L rproc for Sophgo CV1800B SoC
2025-06-08 2:37 [PATCH 0/2] remoteproc: cv1800b: Add initial support for C906L processor Junhui Liu
@ 2025-06-08 2:37 ` Junhui Liu
2025-06-11 9:01 ` Chen Wang
2025-06-25 19:16 ` Rob Herring
2025-06-08 2:37 ` [PATCH 2/2] drivers: remoteproc: Add C906L controller " Junhui Liu
1 sibling, 2 replies; 11+ messages in thread
From: Junhui Liu @ 2025-06-08 2:37 UTC (permalink / raw)
To: Bjorn Andersson, Mathieu Poirier, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Chen Wang, Inochi Amaoto,
Junhui Liu, Philipp Zabel, Paul Walmsley, Palmer Dabbelt,
Albert Ou, Alexandre Ghiti
Cc: linux-remoteproc, devicetree, sophgo, linux-kernel, linux-riscv
Add C906L remote processor for CV1800B SoC, which is an asymmetric
processor typically running RTOS.
Signed-off-by: Junhui Liu <junhui.liu@pigmoral.tech>
---
.../bindings/remoteproc/sophgo,cv1800b-c906l.yaml | 68 ++++++++++++++++++++++
1 file changed, 68 insertions(+)
diff --git a/Documentation/devicetree/bindings/remoteproc/sophgo,cv1800b-c906l.yaml b/Documentation/devicetree/bindings/remoteproc/sophgo,cv1800b-c906l.yaml
new file mode 100644
index 0000000000000000000000000000000000000000..455e957dec01c16424c49ebe5ef451883b0c3d4a
--- /dev/null
+++ b/Documentation/devicetree/bindings/remoteproc/sophgo,cv1800b-c906l.yaml
@@ -0,0 +1,68 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/remoteproc/sophgo,cv1800b-c906l.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Sophgo C906L remote processor controller for CV1800B SoC
+
+maintainers:
+ - Junhui Liu <junhui.liu@pigmoral.tech>
+
+description:
+ Document the bindings for the C906L remoteproc component that loads and boots
+ firmwares on the CV1800B SoC.
+
+properties:
+ compatible:
+ const: sophgo,cv1800b-c906l
+
+ firmware-name:
+ $ref: /schemas/types.yaml#/definitions/string
+ description:
+ The name of the firmware file to load for this remote processor, relative
+ to the firmware search path (typically /lib/firmware/).
+
+ memory-region:
+ description:
+ Phandle to a reserved memory region that is used to load the firmware for
+ this remote processor. The remote processor will use this memory region
+ as its execution memory.
+
+ resets:
+ maxItems: 1
+
+ sophgo,syscon:
+ $ref: /schemas/types.yaml#/definitions/phandle
+ description:
+ A phandle to the SEC_SYS region, used for configuration of the remote processor.
+
+required:
+ - compatible
+ - firmware-name
+ - memory-region
+ - resets
+ - sophgo,syscon
+
+additionalProperties: false
+
+examples:
+ - |
+ reserved-memory {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ ranges;
+
+ c906l_mem: region@83f40000 {
+ reg = <0x83f40000 0xc0000>;
+ no-map;
+ };
+ };
+
+ c906l-rproc {
+ compatible = "sophgo,cv1800b-c906l";
+ firmware-name = "c906l-firmware.elf";
+ memory-region = <&c906l_mem>;
+ resets = <&rst 294>;
+ sophgo,syscon = <&sec_sys>;
+ };
--
2.49.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 2/2] drivers: remoteproc: Add C906L controller for Sophgo CV1800B SoC
2025-06-08 2:37 [PATCH 0/2] remoteproc: cv1800b: Add initial support for C906L processor Junhui Liu
2025-06-08 2:37 ` [PATCH 1/2] dt-bindings: remoteproc: Add C906L rproc for Sophgo CV1800B SoC Junhui Liu
@ 2025-06-08 2:37 ` Junhui Liu
2025-06-09 8:43 ` Peng Fan
2025-06-10 5:15 ` kernel test robot
1 sibling, 2 replies; 11+ messages in thread
From: Junhui Liu @ 2025-06-08 2:37 UTC (permalink / raw)
To: Bjorn Andersson, Mathieu Poirier, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Chen Wang, Inochi Amaoto,
Junhui Liu, Philipp Zabel, Paul Walmsley, Palmer Dabbelt,
Albert Ou, Alexandre Ghiti
Cc: linux-remoteproc, devicetree, sophgo, linux-kernel, linux-riscv
Add initial support for the C906L remote processor found in the Sophgo
CV1800B SoC. The C906L is an asymmetric core typically used to run an
RTOS. This driver enables firmware loading and start/stop control of the
C906L processor via the remoteproc framework.
The C906L and the main application processor can communicate through
mailboxes [1]. Support for mailbox-based functionality will be added in
a separate patch.
Link: https://lore.kernel.org/linux-riscv/20250520-cv18xx-mbox-v4-0-fd4f1c676d6e@pigmoral.tech/ [1]
Signed-off-by: Junhui Liu <junhui.liu@pigmoral.tech>
---
drivers/remoteproc/Kconfig | 9 ++
drivers/remoteproc/Makefile | 1 +
drivers/remoteproc/sophgo_cv1800b_c906l.c | 233 ++++++++++++++++++++++++++++++
3 files changed, 243 insertions(+)
diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig
index 83962a114dc9fdb3260e6e922602f2da53106265..7b09a8f00332605ee528ff7c21c31091c10c2bf5 100644
--- a/drivers/remoteproc/Kconfig
+++ b/drivers/remoteproc/Kconfig
@@ -299,6 +299,15 @@ config RCAR_REMOTEPROC
This can be either built-in or a loadable module.
If compiled as module (M), the module name is rcar_rproc.
+config SOPHGO_CV1800B_C906L
+ tristate "Sophgo CV1800B C906L remoteproc support"
+ depends on ARCH_SOPHGO || COMPILE_TEST
+ help
+ Say y here to support CV1800B C906L remote processor via the remote
+ processor framework.
+
+ It's safe to say N here.
+
config ST_REMOTEPROC
tristate "ST remoteproc support"
depends on ARCH_STI
diff --git a/drivers/remoteproc/Makefile b/drivers/remoteproc/Makefile
index 1c7598b8475d6057a3e044b41e3515103b7aa9f1..3c1e9387491cedc9dda8219f1e9130a84538156f 100644
--- a/drivers/remoteproc/Makefile
+++ b/drivers/remoteproc/Makefile
@@ -33,6 +33,7 @@ obj-$(CONFIG_QCOM_WCNSS_PIL) += qcom_wcnss_pil.o
qcom_wcnss_pil-y += qcom_wcnss.o
qcom_wcnss_pil-y += qcom_wcnss_iris.o
obj-$(CONFIG_RCAR_REMOTEPROC) += rcar_rproc.o
+obj-$(CONFIG_SOPHGO_CV1800B_C906L) += sophgo_cv1800b_c906l.o
obj-$(CONFIG_ST_REMOTEPROC) += st_remoteproc.o
obj-$(CONFIG_ST_SLIM_REMOTEPROC) += st_slim_rproc.o
obj-$(CONFIG_STM32_RPROC) += stm32_rproc.o
diff --git a/drivers/remoteproc/sophgo_cv1800b_c906l.c b/drivers/remoteproc/sophgo_cv1800b_c906l.c
new file mode 100644
index 0000000000000000000000000000000000000000..f3c8d8fd4f796d0cf64f8ab0dd797e017b8e8be7
--- /dev/null
+++ b/drivers/remoteproc/sophgo_cv1800b_c906l.c
@@ -0,0 +1,233 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2025 Junhui Liu <junhui.liu@pigmoral.tech>
+ */
+
+#include <linux/mfd/syscon.h>
+#include <linux/module.h>
+#include <linux/of_device.h>
+#include <linux/of_reserved_mem.h>
+#include <linux/platform_device.h>
+#include <linux/remoteproc.h>
+#include <linux/reset.h>
+#include <linux/regmap.h>
+
+#include "remoteproc_internal.h"
+
+#define CV1800B_SYS_C906L_CTRL_REG 0x04
+#define CV1800B_SYS_C906L_CTRL_EN BIT(13)
+
+#define CV1800B_SYS_C906L_BOOTADDR_REG 0x20
+
+/**
+ * struct cv1800b_c906l - C906L remoteproc structure
+ * @dev: private pointer to the device
+ * @reset: reset control handle
+ * @rproc: the remote processor handle
+ * @syscon: regmap for accessing security system registers
+ */
+struct cv1800b_c906l {
+ struct device *dev;
+ struct reset_control *reset;
+ struct rproc *rproc;
+ struct regmap *syscon;
+};
+
+static int cv1800b_c906l_mem_alloc(struct rproc *rproc,
+ struct rproc_mem_entry *mem)
+{
+ void *va;
+
+ va = ioremap_wc(mem->dma, mem->len);
+ if (IS_ERR_OR_NULL(va))
+ return -ENOMEM;
+
+ /* Update memory entry va */
+ mem->va = va;
+
+ return 0;
+}
+
+static int cv1800b_c906l_mem_release(struct rproc *rproc,
+ struct rproc_mem_entry *mem)
+{
+ iounmap(mem->va);
+
+ return 0;
+}
+
+static int cv1800b_c906l_add_carveout(struct rproc *rproc)
+{
+ struct device *dev = rproc->dev.parent;
+ struct device_node *np = dev->of_node;
+ struct of_phandle_iterator it;
+ struct rproc_mem_entry *mem;
+ struct reserved_mem *rmem;
+
+ /* Register associated reserved memory regions */
+ of_phandle_iterator_init(&it, np, "memory-region", NULL, 0);
+ while (of_phandle_iterator_next(&it) == 0) {
+ rmem = of_reserved_mem_lookup(it.node);
+ if (!rmem) {
+ of_node_put(it.node);
+ return -EINVAL;
+ }
+
+ mem = rproc_mem_entry_init(dev, NULL, (dma_addr_t)rmem->base,
+ rmem->size, rmem->base,
+ cv1800b_c906l_mem_alloc,
+ cv1800b_c906l_mem_release,
+ it.node->name);
+
+ if (!mem) {
+ of_node_put(it.node);
+ return -ENOMEM;
+ }
+
+ rproc_add_carveout(rproc, mem);
+ }
+
+ return 0;
+}
+
+static int cv1800b_c906l_prepare(struct rproc *rproc)
+{
+ struct cv1800b_c906l *priv = rproc->priv;
+ int ret;
+
+ ret = cv1800b_c906l_add_carveout(rproc);
+ if (ret)
+ return ret;
+
+ /*
+ * This control bit must be set to enable the C906L remote processor.
+ * Note that once the remote processor is running, merely clearing
+ * this bit will not stop its execution.
+ */
+ return regmap_update_bits(priv->syscon, CV1800B_SYS_C906L_CTRL_REG,
+ CV1800B_SYS_C906L_CTRL_EN,
+ CV1800B_SYS_C906L_CTRL_EN);
+}
+
+static int cv1800b_c906l_start(struct rproc *rproc)
+{
+ struct cv1800b_c906l *priv = rproc->priv;
+ u32 bootaddr[2];
+ int ret;
+
+ bootaddr[0] = lower_32_bits(rproc->bootaddr);
+ bootaddr[1] = upper_32_bits(rproc->bootaddr);
+
+ ret = regmap_bulk_write(priv->syscon, CV1800B_SYS_C906L_BOOTADDR_REG,
+ bootaddr, ARRAY_SIZE(bootaddr));
+ if (ret)
+ return ret;
+
+ return reset_control_deassert(priv->reset);
+}
+
+static int cv1800b_c906l_stop(struct rproc *rproc)
+{
+ struct cv1800b_c906l *priv = rproc->priv;
+
+ return reset_control_assert(priv->reset);
+}
+
+static int cv1800b_c906l_parse_fw(struct rproc *rproc,
+ const struct firmware *fw)
+{
+ int ret;
+
+ ret = rproc_elf_load_rsc_table(rproc, fw);
+ if (ret == -EINVAL) {
+ dev_info(&rproc->dev, "No resource table in elf\n");
+ ret = 0;
+ }
+
+ return ret;
+}
+
+static const struct rproc_ops cv1800b_c906l_ops = {
+ .prepare = cv1800b_c906l_prepare,
+ .start = cv1800b_c906l_start,
+ .stop = cv1800b_c906l_stop,
+ .load = rproc_elf_load_segments,
+ .parse_fw = cv1800b_c906l_parse_fw,
+ .find_loaded_rsc_table = rproc_elf_find_loaded_rsc_table,
+ .sanity_check = rproc_elf_sanity_check,
+ .get_boot_addr = rproc_elf_get_boot_addr,
+};
+
+static int cv1800b_c906l_probe(struct platform_device *pdev)
+{
+ struct device *dev = &pdev->dev;
+ struct device_node *np = dev->of_node;
+ struct cv1800b_c906l *priv;
+ struct rproc *rproc;
+ const char *fw_name;
+ int ret;
+
+ ret = rproc_of_parse_firmware(dev, 0, &fw_name);
+ if (ret)
+ return dev_err_probe(dev, ret, "No firmware filename given\n");
+
+ rproc = devm_rproc_alloc(dev, dev_name(dev), &cv1800b_c906l_ops,
+ fw_name, sizeof(*priv));
+ if (!rproc)
+ return dev_err_probe(dev, -ENOMEM,
+ "unable to allocate remoteproc\n");
+
+ rproc->has_iommu = false;
+
+ priv = rproc->priv;
+ priv->dev = dev;
+ priv->rproc = rproc;
+
+ priv->syscon = syscon_regmap_lookup_by_phandle(np, "sophgo,syscon");
+ if (IS_ERR(priv->syscon))
+ return PTR_ERR(priv->syscon);
+
+ priv->reset = devm_reset_control_get_exclusive(dev, NULL);
+ if (IS_ERR(priv->reset))
+ return dev_err_probe(dev, PTR_ERR(priv->reset),
+ "failed to get reset control handle\n");
+
+ platform_set_drvdata(pdev, rproc);
+
+ ret = devm_rproc_add(dev, rproc);
+ if (ret)
+ return dev_err_probe(dev, ret, "rproc_add failed\n");
+
+ return 0;
+}
+
+static void cv1800b_c906l_remove(struct platform_device *pdev)
+{
+ struct rproc *rproc = platform_get_drvdata(pdev);
+
+ if (atomic_read(&rproc->power) > 0)
+ rproc_shutdown(rproc);
+
+ rproc_del(rproc);
+}
+
+static const struct of_device_id cv1800b_c906l_of_match[] = {
+ { .compatible = "sophgo,cv1800b-c906l" },
+ { /* sentinel */ },
+};
+MODULE_DEVICE_TABLE(of, cv1800b_c906l_of_match);
+
+static struct platform_driver cv1800b_c906l_driver = {
+ .probe = cv1800b_c906l_probe,
+ .remove = cv1800b_c906l_remove,
+ .driver = {
+ .name = "cv1800b-c906l",
+ .of_match_table = cv1800b_c906l_of_match,
+ },
+};
+
+module_platform_driver(cv1800b_c906l_driver);
+
+MODULE_AUTHOR("Junhui Liu <junhui.liu@pigmoral.tech>");
+MODULE_DESCRIPTION("Sophgo CV1800B C906L remote processor control driver");
+MODULE_LICENSE("GPL");
--
2.49.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 2/2] drivers: remoteproc: Add C906L controller for Sophgo CV1800B SoC
2025-06-08 2:37 ` [PATCH 2/2] drivers: remoteproc: Add C906L controller " Junhui Liu
@ 2025-06-09 8:43 ` Peng Fan
2025-06-10 3:42 ` Junhui Liu
2025-06-10 5:15 ` kernel test robot
1 sibling, 1 reply; 11+ messages in thread
From: Peng Fan @ 2025-06-09 8:43 UTC (permalink / raw)
To: Junhui Liu
Cc: Bjorn Andersson, Mathieu Poirier, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Chen Wang, Inochi Amaoto,
Philipp Zabel, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Alexandre Ghiti, linux-remoteproc, devicetree, sophgo,
linux-kernel, linux-riscv
On Sun, Jun 08, 2025 at 10:37:40AM +0800, Junhui Liu wrote:
>Add initial support for the C906L remote processor found in the Sophgo
>CV1800B SoC. The C906L is an asymmetric core typically used to run an
>RTOS. This driver enables firmware loading and start/stop control of the
>C906L processor via the remoteproc framework.
>
>The C906L and the main application processor can communicate through
>mailboxes [1]. Support for mailbox-based functionality will be added in
>a separate patch.
>
>Link: https://lore.kernel.org/linux-riscv/20250520-cv18xx-mbox-v4-0-fd4f1c676d6e@pigmoral.tech/ [1]
>Signed-off-by: Junhui Liu <junhui.liu@pigmoral.tech>
>---
> drivers/remoteproc/Kconfig | 9 ++
> drivers/remoteproc/Makefile | 1 +
> drivers/remoteproc/sophgo_cv1800b_c906l.c | 233 ++++++++++++++++++++++++++++++
> 3 files changed, 243 insertions(+)
>
>diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig
>index 83962a114dc9fdb3260e6e922602f2da53106265..7b09a8f00332605ee528ff7c21c31091c10c2bf5 100644
>--- a/drivers/remoteproc/Kconfig
>+++ b/drivers/remoteproc/Kconfig
>@@ -299,6 +299,15 @@ config RCAR_REMOTEPROC
> This can be either built-in or a loadable module.
> If compiled as module (M), the module name is rcar_rproc.
>
>+config SOPHGO_CV1800B_C906L
>+ tristate "Sophgo CV1800B C906L remoteproc support"
>+ depends on ARCH_SOPHGO || COMPILE_TEST
>+ help
>+ Say y here to support CV1800B C906L remote processor via the remote
>+ processor framework.
>+
>+ It's safe to say N here.
>+
> config ST_REMOTEPROC
> tristate "ST remoteproc support"
> depends on ARCH_STI
>diff --git a/drivers/remoteproc/Makefile b/drivers/remoteproc/Makefile
>index 1c7598b8475d6057a3e044b41e3515103b7aa9f1..3c1e9387491cedc9dda8219f1e9130a84538156f 100644
>--- a/drivers/remoteproc/Makefile
>+++ b/drivers/remoteproc/Makefile
>@@ -33,6 +33,7 @@ obj-$(CONFIG_QCOM_WCNSS_PIL) += qcom_wcnss_pil.o
> qcom_wcnss_pil-y += qcom_wcnss.o
> qcom_wcnss_pil-y += qcom_wcnss_iris.o
> obj-$(CONFIG_RCAR_REMOTEPROC) += rcar_rproc.o
>+obj-$(CONFIG_SOPHGO_CV1800B_C906L) += sophgo_cv1800b_c906l.o
> obj-$(CONFIG_ST_REMOTEPROC) += st_remoteproc.o
> obj-$(CONFIG_ST_SLIM_REMOTEPROC) += st_slim_rproc.o
> obj-$(CONFIG_STM32_RPROC) += stm32_rproc.o
>diff --git a/drivers/remoteproc/sophgo_cv1800b_c906l.c b/drivers/remoteproc/sophgo_cv1800b_c906l.c
>new file mode 100644
>index 0000000000000000000000000000000000000000..f3c8d8fd4f796d0cf64f8ab0dd797e017b8e8be7
>--- /dev/null
>+++ b/drivers/remoteproc/sophgo_cv1800b_c906l.c
>@@ -0,0 +1,233 @@
>+// SPDX-License-Identifier: GPL-2.0-or-later
>+/*
>+ * Copyright (C) 2025 Junhui Liu <junhui.liu@pigmoral.tech>
>+ */
>+
>+#include <linux/mfd/syscon.h>
>+#include <linux/module.h>
>+#include <linux/of_device.h>
>+#include <linux/of_reserved_mem.h>
>+#include <linux/platform_device.h>
>+#include <linux/remoteproc.h>
>+#include <linux/reset.h>
>+#include <linux/regmap.h>
>+
>+#include "remoteproc_internal.h"
>+
>+#define CV1800B_SYS_C906L_CTRL_REG 0x04
>+#define CV1800B_SYS_C906L_CTRL_EN BIT(13)
Align the format.
'#include <linux/bits.h>' should be added for BIT
>+
>+#define CV1800B_SYS_C906L_BOOTADDR_REG 0x20
>+
>+/**
>+ * struct cv1800b_c906l - C906L remoteproc structure
>+ * @dev: private pointer to the device
>+ * @reset: reset control handle
>+ * @rproc: the remote processor handle
>+ * @syscon: regmap for accessing security system registers
>+ */
>+struct cv1800b_c906l {
>+ struct device *dev;
>+ struct reset_control *reset;
>+ struct rproc *rproc;
>+ struct regmap *syscon;
>+};
>+
>+static int cv1800b_c906l_mem_alloc(struct rproc *rproc,
>+ struct rproc_mem_entry *mem)
>+{
>+ void *va;
>+
>+ va = ioremap_wc(mem->dma, mem->len);
>+ if (IS_ERR_OR_NULL(va))
Use "if (!va)"?
>+ return -ENOMEM;
>+
>+ /* Update memory entry va */
>+ mem->va = va;
>+
>+ return 0;
>+}
>+
>+static int cv1800b_c906l_mem_release(struct rproc *rproc,
>+ struct rproc_mem_entry *mem)
>+{
>+ iounmap(mem->va);
>+
>+ return 0;
>+}
>+
>+static int cv1800b_c906l_add_carveout(struct rproc *rproc)
>+{
>+ struct device *dev = rproc->dev.parent;
>+ struct device_node *np = dev->of_node;
>+ struct of_phandle_iterator it;
>+ struct rproc_mem_entry *mem;
>+ struct reserved_mem *rmem;
>+
>+ /* Register associated reserved memory regions */
>+ of_phandle_iterator_init(&it, np, "memory-region", NULL, 0);
>+ while (of_phandle_iterator_next(&it) == 0) {
>+ rmem = of_reserved_mem_lookup(it.node);
>+ if (!rmem) {
>+ of_node_put(it.node);
>+ return -EINVAL;
>+ }
Is there a need to handle vdev0buffer?
>+
>+ mem = rproc_mem_entry_init(dev, NULL, (dma_addr_t)rmem->base,
>+ rmem->size, rmem->base,
>+ cv1800b_c906l_mem_alloc,
>+ cv1800b_c906l_mem_release,
>+ it.node->name);
>+
>+ if (!mem) {
>+ of_node_put(it.node);
>+ return -ENOMEM;
>+ }
>+
>+ rproc_add_carveout(rproc, mem);
>+ }
>+
>+ return 0;
>+}
>+
>+static int cv1800b_c906l_prepare(struct rproc *rproc)
>+{
>+ struct cv1800b_c906l *priv = rproc->priv;
>+ int ret;
>+
>+ ret = cv1800b_c906l_add_carveout(rproc);
>+ if (ret)
>+ return ret;
>+
>+ /*
>+ * This control bit must be set to enable the C906L remote processor.
>+ * Note that once the remote processor is running, merely clearing
>+ * this bit will not stop its execution.
>+ */
>+ return regmap_update_bits(priv->syscon, CV1800B_SYS_C906L_CTRL_REG,
>+ CV1800B_SYS_C906L_CTRL_EN,
>+ CV1800B_SYS_C906L_CTRL_EN);
>+}
>+
>+static int cv1800b_c906l_start(struct rproc *rproc)
>+{
>+ struct cv1800b_c906l *priv = rproc->priv;
>+ u32 bootaddr[2];
>+ int ret;
>+
>+ bootaddr[0] = lower_32_bits(rproc->bootaddr);
>+ bootaddr[1] = upper_32_bits(rproc->bootaddr);
>+
>+ ret = regmap_bulk_write(priv->syscon, CV1800B_SYS_C906L_BOOTADDR_REG,
>+ bootaddr, ARRAY_SIZE(bootaddr));
>+ if (ret)
>+ return ret;
>+
>+ return reset_control_deassert(priv->reset);
>+}
>+
>+static int cv1800b_c906l_stop(struct rproc *rproc)
>+{
>+ struct cv1800b_c906l *priv = rproc->priv;
>+
>+ return reset_control_assert(priv->reset);
>+}
>+
>+static int cv1800b_c906l_parse_fw(struct rproc *rproc,
>+ const struct firmware *fw)
>+{
>+ int ret;
>+
>+ ret = rproc_elf_load_rsc_table(rproc, fw);
>+ if (ret == -EINVAL) {
>+ dev_info(&rproc->dev, "No resource table in elf\n");
>+ ret = 0;
>+ }
>+
>+ return ret;
>+}
>+
>+static const struct rproc_ops cv1800b_c906l_ops = {
>+ .prepare = cv1800b_c906l_prepare,
>+ .start = cv1800b_c906l_start,
>+ .stop = cv1800b_c906l_stop,
>+ .load = rproc_elf_load_segments,
>+ .parse_fw = cv1800b_c906l_parse_fw,
>+ .find_loaded_rsc_table = rproc_elf_find_loaded_rsc_table,
>+ .sanity_check = rproc_elf_sanity_check,
>+ .get_boot_addr = rproc_elf_get_boot_addr,
Seems your setup does not support attach mode, so better add
attach hook and return -ENOTSUPP?
>+};
>+
>+static int cv1800b_c906l_probe(struct platform_device *pdev)
>+{
>+ struct device *dev = &pdev->dev;
>+ struct device_node *np = dev->of_node;
>+ struct cv1800b_c906l *priv;
>+ struct rproc *rproc;
>+ const char *fw_name;
>+ int ret;
>+
>+ ret = rproc_of_parse_firmware(dev, 0, &fw_name);
>+ if (ret)
>+ return dev_err_probe(dev, ret, "No firmware filename given\n");
>+
>+ rproc = devm_rproc_alloc(dev, dev_name(dev), &cv1800b_c906l_ops,
>+ fw_name, sizeof(*priv));
>+ if (!rproc)
>+ return dev_err_probe(dev, -ENOMEM,
>+ "unable to allocate remoteproc\n");
>+
>+ rproc->has_iommu = false;
>+
>+ priv = rproc->priv;
>+ priv->dev = dev;
>+ priv->rproc = rproc;
>+
>+ priv->syscon = syscon_regmap_lookup_by_phandle(np, "sophgo,syscon");
>+ if (IS_ERR(priv->syscon))
>+ return PTR_ERR(priv->syscon);
>+
>+ priv->reset = devm_reset_control_get_exclusive(dev, NULL);
>+ if (IS_ERR(priv->reset))
>+ return dev_err_probe(dev, PTR_ERR(priv->reset),
>+ "failed to get reset control handle\n");
>+
>+ platform_set_drvdata(pdev, rproc);
>+
>+ ret = devm_rproc_add(dev, rproc);
>+ if (ret)
>+ return dev_err_probe(dev, ret, "rproc_add failed\n");
>+
>+ return 0;
>+}
>+
>+static void cv1800b_c906l_remove(struct platform_device *pdev)
>+{
>+ struct rproc *rproc = platform_get_drvdata(pdev);
>+
>+ if (atomic_read(&rproc->power) > 0)
>+ rproc_shutdown(rproc);
I think the remoteproc framework should block remove to be executed
if 'power > 0'. If not, the framework should be enhanced.
Regards,
Peng
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/2] drivers: remoteproc: Add C906L controller for Sophgo CV1800B SoC
2025-06-09 8:43 ` Peng Fan
@ 2025-06-10 3:42 ` Junhui Liu
2025-06-11 6:29 ` Peng Fan
0 siblings, 1 reply; 11+ messages in thread
From: Junhui Liu @ 2025-06-10 3:42 UTC (permalink / raw)
To: Peng Fan
Cc: Bjorn Andersson, Mathieu Poirier, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Chen Wang, Inochi Amaoto,
Philipp Zabel, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Alexandre Ghiti, linux-remoteproc, devicetree, sophgo,
linux-kernel, linux-riscv
Hi Peng,
Thanks for your review.
On 09/06/2025 16:43, Peng Fan wrote:
> On Sun, Jun 08, 2025 at 10:37:40AM +0800, Junhui Liu wrote:
>>Add initial support for the C906L remote processor found in the Sophgo
>>CV1800B SoC. The C906L is an asymmetric core typically used to run an
>>RTOS. This driver enables firmware loading and start/stop control of the
>>C906L processor via the remoteproc framework.
>>
>>The C906L and the main application processor can communicate through
>>mailboxes [1]. Support for mailbox-based functionality will be added in
>>a separate patch.
>>
>>Link: https://lore.kernel.org/linux-riscv/20250520-cv18xx-mbox-v4-0-fd4f1c676d6e@pigmoral.tech/ [1]
>>Signed-off-by: Junhui Liu <junhui.liu@pigmoral.tech>
>>---
>> drivers/remoteproc/Kconfig | 9 ++
>> drivers/remoteproc/Makefile | 1 +
>> drivers/remoteproc/sophgo_cv1800b_c906l.c | 233 ++++++++++++++++++++++++++++++
>> 3 files changed, 243 insertions(+)
>>
>>diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig
>>index 83962a114dc9fdb3260e6e922602f2da53106265..7b09a8f00332605ee528ff7c21c31091c10c2bf5 100644
>>--- a/drivers/remoteproc/Kconfig
>>+++ b/drivers/remoteproc/Kconfig
>>@@ -299,6 +299,15 @@ config RCAR_REMOTEPROC
>> This can be either built-in or a loadable module.
>> If compiled as module (M), the module name is rcar_rproc.
>>
>>+config SOPHGO_CV1800B_C906L
>>+ tristate "Sophgo CV1800B C906L remoteproc support"
>>+ depends on ARCH_SOPHGO || COMPILE_TEST
>>+ help
>>+ Say y here to support CV1800B C906L remote processor via the remote
>>+ processor framework.
>>+
>>+ It's safe to say N here.
>>+
>> config ST_REMOTEPROC
>> tristate "ST remoteproc support"
>> depends on ARCH_STI
>>diff --git a/drivers/remoteproc/Makefile b/drivers/remoteproc/Makefile
>>index 1c7598b8475d6057a3e044b41e3515103b7aa9f1..3c1e9387491cedc9dda8219f1e9130a84538156f 100644
>>--- a/drivers/remoteproc/Makefile
>>+++ b/drivers/remoteproc/Makefile
>>@@ -33,6 +33,7 @@ obj-$(CONFIG_QCOM_WCNSS_PIL) += qcom_wcnss_pil.o
>> qcom_wcnss_pil-y += qcom_wcnss.o
>> qcom_wcnss_pil-y += qcom_wcnss_iris.o
>> obj-$(CONFIG_RCAR_REMOTEPROC) += rcar_rproc.o
>>+obj-$(CONFIG_SOPHGO_CV1800B_C906L) += sophgo_cv1800b_c906l.o
>> obj-$(CONFIG_ST_REMOTEPROC) += st_remoteproc.o
>> obj-$(CONFIG_ST_SLIM_REMOTEPROC) += st_slim_rproc.o
>> obj-$(CONFIG_STM32_RPROC) += stm32_rproc.o
>>diff --git a/drivers/remoteproc/sophgo_cv1800b_c906l.c b/drivers/remoteproc/sophgo_cv1800b_c906l.c
>>new file mode 100644
>>index 0000000000000000000000000000000000000000..f3c8d8fd4f796d0cf64f8ab0dd797e017b8e8be7
>>--- /dev/null
>>+++ b/drivers/remoteproc/sophgo_cv1800b_c906l.c
>>@@ -0,0 +1,233 @@
>>+// SPDX-License-Identifier: GPL-2.0-or-later
>>+/*
>>+ * Copyright (C) 2025 Junhui Liu <junhui.liu@pigmoral.tech>
>>+ */
>>+
>>+#include <linux/mfd/syscon.h>
>>+#include <linux/module.h>
>>+#include <linux/of_device.h>
>>+#include <linux/of_reserved_mem.h>
>>+#include <linux/platform_device.h>
>>+#include <linux/remoteproc.h>
>>+#include <linux/reset.h>
>>+#include <linux/regmap.h>
>>+
>>+#include "remoteproc_internal.h"
>>+
>>+#define CV1800B_SYS_C906L_CTRL_REG 0x04
>>+#define CV1800B_SYS_C906L_CTRL_EN BIT(13)
>
> Align the format.
>
> '#include <linux/bits.h>' should be added for BIT
>
Will do in v2.
>>+
>>+#define CV1800B_SYS_C906L_BOOTADDR_REG 0x20
>>+
>>+/**
>>+ * struct cv1800b_c906l - C906L remoteproc structure
>>+ * @dev: private pointer to the device
>>+ * @reset: reset control handle
>>+ * @rproc: the remote processor handle
>>+ * @syscon: regmap for accessing security system registers
>>+ */
>>+struct cv1800b_c906l {
>>+ struct device *dev;
>>+ struct reset_control *reset;
>>+ struct rproc *rproc;
>>+ struct regmap *syscon;
>>+};
>>+
>>+static int cv1800b_c906l_mem_alloc(struct rproc *rproc,
>>+ struct rproc_mem_entry *mem)
>>+{
>>+ void *va;
>>+
>>+ va = ioremap_wc(mem->dma, mem->len);
>>+ if (IS_ERR_OR_NULL(va))
>
> Use "if (!va)"?
Will do in v2.
>
>>+ return -ENOMEM;
>>+
>>+ /* Update memory entry va */
>>+ mem->va = va;
>>+
>>+ return 0;
>>+}
>>+
>>+static int cv1800b_c906l_mem_release(struct rproc *rproc,
>>+ struct rproc_mem_entry *mem)
>>+{
>>+ iounmap(mem->va);
>>+
>>+ return 0;
>>+}
>>+
>>+static int cv1800b_c906l_add_carveout(struct rproc *rproc)
>>+{
>>+ struct device *dev = rproc->dev.parent;
>>+ struct device_node *np = dev->of_node;
>>+ struct of_phandle_iterator it;
>>+ struct rproc_mem_entry *mem;
>>+ struct reserved_mem *rmem;
>>+
>>+ /* Register associated reserved memory regions */
>>+ of_phandle_iterator_init(&it, np, "memory-region", NULL, 0);
>>+ while (of_phandle_iterator_next(&it) == 0) {
>>+ rmem = of_reserved_mem_lookup(it.node);
>>+ if (!rmem) {
>>+ of_node_put(it.node);
>>+ return -EINVAL;
>>+ }
>
> Is there a need to handle vdev0buffer?
I'll exclude it.
>
>>+
>>+ mem = rproc_mem_entry_init(dev, NULL, (dma_addr_t)rmem->base,
>>+ rmem->size, rmem->base,
>>+ cv1800b_c906l_mem_alloc,
>>+ cv1800b_c906l_mem_release,
>>+ it.node->name);
>>+
>>+ if (!mem) {
>>+ of_node_put(it.node);
>>+ return -ENOMEM;
>>+ }
>>+
>>+ rproc_add_carveout(rproc, mem);
>>+ }
>>+
>>+ return 0;
>>+}
>>+
>>+static int cv1800b_c906l_prepare(struct rproc *rproc)
>>+{
>>+ struct cv1800b_c906l *priv = rproc->priv;
>>+ int ret;
>>+
>>+ ret = cv1800b_c906l_add_carveout(rproc);
>>+ if (ret)
>>+ return ret;
>>+
>>+ /*
>>+ * This control bit must be set to enable the C906L remote processor.
>>+ * Note that once the remote processor is running, merely clearing
>>+ * this bit will not stop its execution.
>>+ */
>>+ return regmap_update_bits(priv->syscon, CV1800B_SYS_C906L_CTRL_REG,
>>+ CV1800B_SYS_C906L_CTRL_EN,
>>+ CV1800B_SYS_C906L_CTRL_EN);
>>+}
>>+
>>+static int cv1800b_c906l_start(struct rproc *rproc)
>>+{
>>+ struct cv1800b_c906l *priv = rproc->priv;
>>+ u32 bootaddr[2];
>>+ int ret;
>>+
>>+ bootaddr[0] = lower_32_bits(rproc->bootaddr);
>>+ bootaddr[1] = upper_32_bits(rproc->bootaddr);
>>+
>>+ ret = regmap_bulk_write(priv->syscon, CV1800B_SYS_C906L_BOOTADDR_REG,
>>+ bootaddr, ARRAY_SIZE(bootaddr));
>>+ if (ret)
>>+ return ret;
>>+
>>+ return reset_control_deassert(priv->reset);
>>+}
>>+
>>+static int cv1800b_c906l_stop(struct rproc *rproc)
>>+{
>>+ struct cv1800b_c906l *priv = rproc->priv;
>>+
>>+ return reset_control_assert(priv->reset);
>>+}
>>+
>>+static int cv1800b_c906l_parse_fw(struct rproc *rproc,
>>+ const struct firmware *fw)
>>+{
>>+ int ret;
>>+
>>+ ret = rproc_elf_load_rsc_table(rproc, fw);
>>+ if (ret == -EINVAL) {
>>+ dev_info(&rproc->dev, "No resource table in elf\n");
>>+ ret = 0;
>>+ }
>>+
>>+ return ret;
>>+}
>>+
>>+static const struct rproc_ops cv1800b_c906l_ops = {
>>+ .prepare = cv1800b_c906l_prepare,
>>+ .start = cv1800b_c906l_start,
>>+ .stop = cv1800b_c906l_stop,
>>+ .load = rproc_elf_load_segments,
>>+ .parse_fw = cv1800b_c906l_parse_fw,
>>+ .find_loaded_rsc_table = rproc_elf_find_loaded_rsc_table,
>>+ .sanity_check = rproc_elf_sanity_check,
>>+ .get_boot_addr = rproc_elf_get_boot_addr,
>
> Seems your setup does not support attach mode, so better add
> attach hook and return -ENOTSUPP?
I checked the remoteproc framework code and found that the attach
function will only be called when 'rproc->state == RPROC_DETACHED', and
it seems that rproc->state will not be set to RPROC_DETACHED unless I do
so explicitly in the driver or an implemented detach function is called,
neither of which happens in this driver.
Given this, do we still need to add an attach hook even though it will
not be called in practice?
>
>>+};
>>+
>>+static int cv1800b_c906l_probe(struct platform_device *pdev)
>>+{
>>+ struct device *dev = &pdev->dev;
>>+ struct device_node *np = dev->of_node;
>>+ struct cv1800b_c906l *priv;
>>+ struct rproc *rproc;
>>+ const char *fw_name;
>>+ int ret;
>>+
>>+ ret = rproc_of_parse_firmware(dev, 0, &fw_name);
>>+ if (ret)
>>+ return dev_err_probe(dev, ret, "No firmware filename given\n");
>>+
>>+ rproc = devm_rproc_alloc(dev, dev_name(dev), &cv1800b_c906l_ops,
>>+ fw_name, sizeof(*priv));
>>+ if (!rproc)
>>+ return dev_err_probe(dev, -ENOMEM,
>>+ "unable to allocate remoteproc\n");
>>+
>>+ rproc->has_iommu = false;
>>+
>>+ priv = rproc->priv;
>>+ priv->dev = dev;
>>+ priv->rproc = rproc;
>>+
>>+ priv->syscon = syscon_regmap_lookup_by_phandle(np, "sophgo,syscon");
>>+ if (IS_ERR(priv->syscon))
>>+ return PTR_ERR(priv->syscon);
>>+
>>+ priv->reset = devm_reset_control_get_exclusive(dev, NULL);
>>+ if (IS_ERR(priv->reset))
>>+ return dev_err_probe(dev, PTR_ERR(priv->reset),
>>+ "failed to get reset control handle\n");
>>+
>>+ platform_set_drvdata(pdev, rproc);
>>+
>>+ ret = devm_rproc_add(dev, rproc);
>>+ if (ret)
>>+ return dev_err_probe(dev, ret, "rproc_add failed\n");
>>+
>>+ return 0;
>>+}
>>+
>>+static void cv1800b_c906l_remove(struct platform_device *pdev)
>>+{
>>+ struct rproc *rproc = platform_get_drvdata(pdev);
>>+
>>+ if (atomic_read(&rproc->power) > 0)
>>+ rproc_shutdown(rproc);
>
> I think the remoteproc framework should block remove to be executed
> if 'power > 0'. If not, the framework should be enhanced.
Okay. I realized that rproc_shutdown() will be called in rproc_del(), I
will remove rproc_shutdown() and only keep rproc_del()
>
> Regards,
> Peng
--
Best regards,
Junhui Liu
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/2] drivers: remoteproc: Add C906L controller for Sophgo CV1800B SoC
2025-06-08 2:37 ` [PATCH 2/2] drivers: remoteproc: Add C906L controller " Junhui Liu
2025-06-09 8:43 ` Peng Fan
@ 2025-06-10 5:15 ` kernel test robot
1 sibling, 0 replies; 11+ messages in thread
From: kernel test robot @ 2025-06-10 5:15 UTC (permalink / raw)
To: Junhui Liu, Bjorn Andersson, Mathieu Poirier, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Chen Wang, Inochi Amaoto,
Philipp Zabel, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Alexandre Ghiti
Cc: oe-kbuild-all, linux-remoteproc, devicetree, sophgo, linux-kernel,
linux-riscv
Hi Junhui,
kernel test robot noticed the following build warnings:
[auto build test WARNING on 8630c59e99363c4b655788fd01134aef9bcd9264]
url: https://github.com/intel-lab-lkp/linux/commits/Junhui-Liu/dt-bindings-remoteproc-Add-C906L-rproc-for-Sophgo-CV1800B-SoC/20250608-104249
base: 8630c59e99363c4b655788fd01134aef9bcd9264
patch link: https://lore.kernel.org/r/20250608-cv1800-rproc-v1-2-57cf66cdf6a3%40pigmoral.tech
patch subject: [PATCH 2/2] drivers: remoteproc: Add C906L controller for Sophgo CV1800B SoC
config: nios2-randconfig-r132-20250610 (https://download.01.org/0day-ci/archive/20250610/202506101252.4HRoLbL7-lkp@intel.com/config)
compiler: nios2-linux-gcc (GCC) 8.5.0
reproduce: (https://download.01.org/0day-ci/archive/20250610/202506101252.4HRoLbL7-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202506101252.4HRoLbL7-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
>> drivers/remoteproc/sophgo_cv1800b_c906l.c:41:12: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void *va @@ got void [noderef] __iomem * @@
drivers/remoteproc/sophgo_cv1800b_c906l.c:41:12: sparse: expected void *va
drivers/remoteproc/sophgo_cv1800b_c906l.c:41:12: sparse: got void [noderef] __iomem *
>> drivers/remoteproc/sophgo_cv1800b_c906l.c:54:20: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void [noderef] __iomem *addr @@ got void *va @@
drivers/remoteproc/sophgo_cv1800b_c906l.c:54:20: sparse: expected void [noderef] __iomem *addr
drivers/remoteproc/sophgo_cv1800b_c906l.c:54:20: sparse: got void *va
vim +41 drivers/remoteproc/sophgo_cv1800b_c906l.c
35
36 static int cv1800b_c906l_mem_alloc(struct rproc *rproc,
37 struct rproc_mem_entry *mem)
38 {
39 void *va;
40
> 41 va = ioremap_wc(mem->dma, mem->len);
42 if (IS_ERR_OR_NULL(va))
43 return -ENOMEM;
44
45 /* Update memory entry va */
46 mem->va = va;
47
48 return 0;
49 }
50
51 static int cv1800b_c906l_mem_release(struct rproc *rproc,
52 struct rproc_mem_entry *mem)
53 {
> 54 iounmap(mem->va);
55
56 return 0;
57 }
58
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/2] drivers: remoteproc: Add C906L controller for Sophgo CV1800B SoC
2025-06-10 3:42 ` Junhui Liu
@ 2025-06-11 6:29 ` Peng Fan
0 siblings, 0 replies; 11+ messages in thread
From: Peng Fan @ 2025-06-11 6:29 UTC (permalink / raw)
To: Junhui Liu
Cc: Bjorn Andersson, Mathieu Poirier, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Chen Wang, Inochi Amaoto,
Philipp Zabel, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Alexandre Ghiti, linux-remoteproc, devicetree, sophgo,
linux-kernel, linux-riscv
On Tue, Jun 10, 2025 at 03:42:57AM +0000, Junhui Liu wrote:
>Hi Peng,
>Thanks for your review.
>
>On 09/06/2025 16:43, Peng Fan wrote:
>> On Sun, Jun 08, 2025 at 10:37:40AM +0800, Junhui Liu wrote:
>>>Add initial support for the C906L remote processor found in the Sophgo
>>>CV1800B SoC. The C906L is an asymmetric core typically used to run an
>>>RTOS. This driver enables firmware loading and start/stop control of the
>>>C906L processor via the remoteproc framework.
>>>
>>>The C906L and the main application processor can communicate through
>>>mailboxes [1]. Support for mailbox-based functionality will be added in
>>>a separate patch.
>>>
>>>Link: https://lore.kernel.org/linux-riscv/20250520-cv18xx-mbox-v4-0-fd4f1c676d6e@pigmoral.tech/ [1]
>>>Signed-off-by: Junhui Liu <junhui.liu@pigmoral.tech>
>>>---
>>> drivers/remoteproc/Kconfig | 9 ++
>>> drivers/remoteproc/Makefile | 1 +
>>> drivers/remoteproc/sophgo_cv1800b_c906l.c | 233 ++++++++++++++++++++++++++++++
>>> 3 files changed, 243 insertions(+)
>>>
>>>diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig
>>>index 83962a114dc9fdb3260e6e922602f2da53106265..7b09a8f00332605ee528ff7c21c31091c10c2bf5 100644
>>>--- a/drivers/remoteproc/Kconfig
>>>+++ b/drivers/remoteproc/Kconfig
>>>@@ -299,6 +299,15 @@ config RCAR_REMOTEPROC
>>> This can be either built-in or a loadable module.
>>> If compiled as module (M), the module name is rcar_rproc.
>>>
>>>+config SOPHGO_CV1800B_C906L
>>>+ tristate "Sophgo CV1800B C906L remoteproc support"
>>>+ depends on ARCH_SOPHGO || COMPILE_TEST
>>>+ help
>>>+ Say y here to support CV1800B C906L remote processor via the remote
>>>+ processor framework.
>>>+
>>>+ It's safe to say N here.
>>>+
>>> config ST_REMOTEPROC
>>> tristate "ST remoteproc support"
>>> depends on ARCH_STI
>>>diff --git a/drivers/remoteproc/Makefile b/drivers/remoteproc/Makefile
>>>index 1c7598b8475d6057a3e044b41e3515103b7aa9f1..3c1e9387491cedc9dda8219f1e9130a84538156f 100644
>>>--- a/drivers/remoteproc/Makefile
>>>+++ b/drivers/remoteproc/Makefile
>>>@@ -33,6 +33,7 @@ obj-$(CONFIG_QCOM_WCNSS_PIL) += qcom_wcnss_pil.o
>>> qcom_wcnss_pil-y += qcom_wcnss.o
>>> qcom_wcnss_pil-y += qcom_wcnss_iris.o
>>> obj-$(CONFIG_RCAR_REMOTEPROC) += rcar_rproc.o
>>>+obj-$(CONFIG_SOPHGO_CV1800B_C906L) += sophgo_cv1800b_c906l.o
>>> obj-$(CONFIG_ST_REMOTEPROC) += st_remoteproc.o
>>> obj-$(CONFIG_ST_SLIM_REMOTEPROC) += st_slim_rproc.o
>>> obj-$(CONFIG_STM32_RPROC) += stm32_rproc.o
>>>diff --git a/drivers/remoteproc/sophgo_cv1800b_c906l.c b/drivers/remoteproc/sophgo_cv1800b_c906l.c
>>>new file mode 100644
>>>index 0000000000000000000000000000000000000000..f3c8d8fd4f796d0cf64f8ab0dd797e017b8e8be7
>>>--- /dev/null
>>>+++ b/drivers/remoteproc/sophgo_cv1800b_c906l.c
>>>@@ -0,0 +1,233 @@
>>>+// SPDX-License-Identifier: GPL-2.0-or-later
>>>+/*
>>>+ * Copyright (C) 2025 Junhui Liu <junhui.liu@pigmoral.tech>
>>>+ */
>>>+
>>>+#include <linux/mfd/syscon.h>
>>>+#include <linux/module.h>
>>>+#include <linux/of_device.h>
>>>+#include <linux/of_reserved_mem.h>
>>>+#include <linux/platform_device.h>
>>>+#include <linux/remoteproc.h>
>>>+#include <linux/reset.h>
>>>+#include <linux/regmap.h>
>>>+
>>>+#include "remoteproc_internal.h"
>>>+
>>>+#define CV1800B_SYS_C906L_CTRL_REG 0x04
>>>+#define CV1800B_SYS_C906L_CTRL_EN BIT(13)
>>
>> Align the format.
>>
>> '#include <linux/bits.h>' should be added for BIT
>>
>
>Will do in v2.
>
>>>+
>>>+#define CV1800B_SYS_C906L_BOOTADDR_REG 0x20
>>>+
>>>+/**
>>>+ * struct cv1800b_c906l - C906L remoteproc structure
>>>+ * @dev: private pointer to the device
>>>+ * @reset: reset control handle
>>>+ * @rproc: the remote processor handle
>>>+ * @syscon: regmap for accessing security system registers
>>>+ */
>>>+struct cv1800b_c906l {
>>>+ struct device *dev;
>>>+ struct reset_control *reset;
>>>+ struct rproc *rproc;
>>>+ struct regmap *syscon;
>>>+};
>>>+
>>>+static int cv1800b_c906l_mem_alloc(struct rproc *rproc,
>>>+ struct rproc_mem_entry *mem)
>>>+{
>>>+ void *va;
>>>+
>>>+ va = ioremap_wc(mem->dma, mem->len);
>>>+ if (IS_ERR_OR_NULL(va))
>>
>> Use "if (!va)"?
>
>Will do in v2.
>
>>
>>>+ return -ENOMEM;
>>>+
>>>+ /* Update memory entry va */
>>>+ mem->va = va;
>>>+
>>>+ return 0;
>>>+}
>>>+
>>>+static int cv1800b_c906l_mem_release(struct rproc *rproc,
>>>+ struct rproc_mem_entry *mem)
>>>+{
>>>+ iounmap(mem->va);
>>>+
>>>+ return 0;
>>>+}
>>>+
>>>+static int cv1800b_c906l_add_carveout(struct rproc *rproc)
>>>+{
>>>+ struct device *dev = rproc->dev.parent;
>>>+ struct device_node *np = dev->of_node;
>>>+ struct of_phandle_iterator it;
>>>+ struct rproc_mem_entry *mem;
>>>+ struct reserved_mem *rmem;
>>>+
>>>+ /* Register associated reserved memory regions */
>>>+ of_phandle_iterator_init(&it, np, "memory-region", NULL, 0);
>>>+ while (of_phandle_iterator_next(&it) == 0) {
>>>+ rmem = of_reserved_mem_lookup(it.node);
>>>+ if (!rmem) {
>>>+ of_node_put(it.node);
>>>+ return -EINVAL;
>>>+ }
>>
>> Is there a need to handle vdev0buffer?
>
>I'll exclude it.
>
>>
>>>+
>>>+ mem = rproc_mem_entry_init(dev, NULL, (dma_addr_t)rmem->base,
>>>+ rmem->size, rmem->base,
>>>+ cv1800b_c906l_mem_alloc,
>>>+ cv1800b_c906l_mem_release,
>>>+ it.node->name);
>>>+
>>>+ if (!mem) {
>>>+ of_node_put(it.node);
>>>+ return -ENOMEM;
>>>+ }
>>>+
>>>+ rproc_add_carveout(rproc, mem);
>>>+ }
>>>+
>>>+ return 0;
>>>+}
>>>+
>>>+static int cv1800b_c906l_prepare(struct rproc *rproc)
>>>+{
>>>+ struct cv1800b_c906l *priv = rproc->priv;
>>>+ int ret;
>>>+
>>>+ ret = cv1800b_c906l_add_carveout(rproc);
>>>+ if (ret)
>>>+ return ret;
>>>+
>>>+ /*
>>>+ * This control bit must be set to enable the C906L remote processor.
>>>+ * Note that once the remote processor is running, merely clearing
>>>+ * this bit will not stop its execution.
>>>+ */
>>>+ return regmap_update_bits(priv->syscon, CV1800B_SYS_C906L_CTRL_REG,
>>>+ CV1800B_SYS_C906L_CTRL_EN,
>>>+ CV1800B_SYS_C906L_CTRL_EN);
>>>+}
>>>+
>>>+static int cv1800b_c906l_start(struct rproc *rproc)
>>>+{
>>>+ struct cv1800b_c906l *priv = rproc->priv;
>>>+ u32 bootaddr[2];
>>>+ int ret;
>>>+
>>>+ bootaddr[0] = lower_32_bits(rproc->bootaddr);
>>>+ bootaddr[1] = upper_32_bits(rproc->bootaddr);
>>>+
>>>+ ret = regmap_bulk_write(priv->syscon, CV1800B_SYS_C906L_BOOTADDR_REG,
>>>+ bootaddr, ARRAY_SIZE(bootaddr));
>>>+ if (ret)
>>>+ return ret;
>>>+
>>>+ return reset_control_deassert(priv->reset);
>>>+}
>>>+
>>>+static int cv1800b_c906l_stop(struct rproc *rproc)
>>>+{
>>>+ struct cv1800b_c906l *priv = rproc->priv;
>>>+
>>>+ return reset_control_assert(priv->reset);
>>>+}
>>>+
>>>+static int cv1800b_c906l_parse_fw(struct rproc *rproc,
>>>+ const struct firmware *fw)
>>>+{
>>>+ int ret;
>>>+
>>>+ ret = rproc_elf_load_rsc_table(rproc, fw);
>>>+ if (ret == -EINVAL) {
>>>+ dev_info(&rproc->dev, "No resource table in elf\n");
>>>+ ret = 0;
>>>+ }
>>>+
>>>+ return ret;
>>>+}
>>>+
>>>+static const struct rproc_ops cv1800b_c906l_ops = {
>>>+ .prepare = cv1800b_c906l_prepare,
>>>+ .start = cv1800b_c906l_start,
>>>+ .stop = cv1800b_c906l_stop,
>>>+ .load = rproc_elf_load_segments,
>>>+ .parse_fw = cv1800b_c906l_parse_fw,
>>>+ .find_loaded_rsc_table = rproc_elf_find_loaded_rsc_table,
>>>+ .sanity_check = rproc_elf_sanity_check,
>>>+ .get_boot_addr = rproc_elf_get_boot_addr,
>>
>> Seems your setup does not support attach mode, so better add
>> attach hook and return -ENOTSUPP?
>
>I checked the remoteproc framework code and found that the attach
>function will only be called when 'rproc->state == RPROC_DETACHED', and
>it seems that rproc->state will not be set to RPROC_DETACHED unless I do
>so explicitly in the driver or an implemented detach function is called,
>neither of which happens in this driver.
>
>Given this, do we still need to add an attach hook even though it will
>not be called in practice?
There is no need, I overlooked RPROC_DETACHED
Regards,
Peng
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] dt-bindings: remoteproc: Add C906L rproc for Sophgo CV1800B SoC
2025-06-08 2:37 ` [PATCH 1/2] dt-bindings: remoteproc: Add C906L rproc for Sophgo CV1800B SoC Junhui Liu
@ 2025-06-11 9:01 ` Chen Wang
2025-06-11 9:23 ` Junhui Liu
2025-06-25 19:16 ` Rob Herring
1 sibling, 1 reply; 11+ messages in thread
From: Chen Wang @ 2025-06-11 9:01 UTC (permalink / raw)
To: Junhui Liu, Bjorn Andersson, Mathieu Poirier, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Inochi Amaoto, Philipp Zabel,
Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti
Cc: linux-remoteproc, devicetree, sophgo, linux-kernel, linux-riscv
On 2025/6/8 10:37, Junhui Liu wrote:
> Add C906L remote processor for CV1800B SoC, which is an asymmetric
> processor typically running RTOS.
In the cover email, I saw that remoteproc also uses mailbox as the
underlying communication. So I guess some mailbox-related properties
will need to be added to the bindings? I suggest that these should be
determined before officially merging this bindings.
Thanks,
Chen
>
> Signed-off-by: Junhui Liu <junhui.liu@pigmoral.tech>
> ---
> .../bindings/remoteproc/sophgo,cv1800b-c906l.yaml | 68 ++++++++++++++++++++++
> 1 file changed, 68 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/remoteproc/sophgo,cv1800b-c906l.yaml b/Documentation/devicetree/bindings/remoteproc/sophgo,cv1800b-c906l.yaml
> new file mode 100644
> index 0000000000000000000000000000000000000000..455e957dec01c16424c49ebe5ef451883b0c3d4a
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/remoteproc/sophgo,cv1800b-c906l.yaml
> @@ -0,0 +1,68 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/remoteproc/sophgo,cv1800b-c906l.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Sophgo C906L remote processor controller for CV1800B SoC
> +
> +maintainers:
> + - Junhui Liu <junhui.liu@pigmoral.tech>
> +
> +description:
> + Document the bindings for the C906L remoteproc component that loads and boots
> + firmwares on the CV1800B SoC.
> +
> +properties:
> + compatible:
> + const: sophgo,cv1800b-c906l
> +
> + firmware-name:
> + $ref: /schemas/types.yaml#/definitions/string
> + description:
> + The name of the firmware file to load for this remote processor, relative
> + to the firmware search path (typically /lib/firmware/).
> +
> + memory-region:
> + description:
> + Phandle to a reserved memory region that is used to load the firmware for
> + this remote processor. The remote processor will use this memory region
> + as its execution memory.
> +
> + resets:
> + maxItems: 1
> +
> + sophgo,syscon:
> + $ref: /schemas/types.yaml#/definitions/phandle
> + description:
> + A phandle to the SEC_SYS region, used for configuration of the remote processor.
> +
> +required:
> + - compatible
> + - firmware-name
> + - memory-region
> + - resets
> + - sophgo,syscon
> +
> +additionalProperties: false
> +
> +examples:
> + - |
> + reserved-memory {
> + #address-cells = <1>;
> + #size-cells = <1>;
> + ranges;
> +
> + c906l_mem: region@83f40000 {
> + reg = <0x83f40000 0xc0000>;
> + no-map;
> + };
> + };
> +
> + c906l-rproc {
> + compatible = "sophgo,cv1800b-c906l";
> + firmware-name = "c906l-firmware.elf";
> + memory-region = <&c906l_mem>;
> + resets = <&rst 294>;
> + sophgo,syscon = <&sec_sys>;
> + };
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] dt-bindings: remoteproc: Add C906L rproc for Sophgo CV1800B SoC
2025-06-11 9:01 ` Chen Wang
@ 2025-06-11 9:23 ` Junhui Liu
0 siblings, 0 replies; 11+ messages in thread
From: Junhui Liu @ 2025-06-11 9:23 UTC (permalink / raw)
To: Chen Wang, Bjorn Andersson, Mathieu Poirier, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Inochi Amaoto, Philipp Zabel,
Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti
Cc: linux-remoteproc, devicetree, sophgo, linux-kernel, linux-riscv
On 11/06/2025 17:01, Chen Wang wrote:
> On 2025/6/8 10:37, Junhui Liu wrote:
>> Add C906L remote processor for CV1800B SoC, which is an asymmetric
>> processor typically running RTOS.
>
> In the cover email, I saw that remoteproc also uses mailbox as the
> underlying communication. So I guess some mailbox-related properties
> will need to be added to the bindings? I suggest that these should be
> determined before officially merging this bindings.
Yes, thanks for your suggestion. I will try to add mailbox-related
properties and functions in the bindings and driver in v2, since the
mailbox driver has been merged. At the very least, I will ensure the
mailbox-related properties are included in the bindings.
>
> Thanks,
>
> Chen
>
>>
>> Signed-off-by: Junhui Liu <junhui.liu@pigmoral.tech>
>> ---
>> .../bindings/remoteproc/sophgo,cv1800b-c906l.yaml | 68 ++++++++++++++++++++++
>> 1 file changed, 68 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/remoteproc/sophgo,cv1800b-c906l.yaml b/Documentation/devicetree/bindings/remoteproc/sophgo,cv1800b-c906l.yaml
>> new file mode 100644
>> index 0000000000000000000000000000000000000000..455e957dec01c16424c49ebe5ef451883b0c3d4a
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/remoteproc/sophgo,cv1800b-c906l.yaml
>> @@ -0,0 +1,68 @@
>> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/remoteproc/sophgo,cv1800b-c906l.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: Sophgo C906L remote processor controller for CV1800B SoC
>> +
>> +maintainers:
>> + - Junhui Liu <junhui.liu@pigmoral.tech>
>> +
>> +description:
>> + Document the bindings for the C906L remoteproc component that loads and boots
>> + firmwares on the CV1800B SoC.
>> +
>> +properties:
>> + compatible:
>> + const: sophgo,cv1800b-c906l
>> +
>> + firmware-name:
>> + $ref: /schemas/types.yaml#/definitions/string
>> + description:
>> + The name of the firmware file to load for this remote processor, relative
>> + to the firmware search path (typically /lib/firmware/).
>> +
>> + memory-region:
>> + description:
>> + Phandle to a reserved memory region that is used to load the firmware for
>> + this remote processor. The remote processor will use this memory region
>> + as its execution memory.
>> +
>> + resets:
>> + maxItems: 1
>> +
>> + sophgo,syscon:
>> + $ref: /schemas/types.yaml#/definitions/phandle
>> + description:
>> + A phandle to the SEC_SYS region, used for configuration of the remote processor.
>> +
>> +required:
>> + - compatible
>> + - firmware-name
>> + - memory-region
>> + - resets
>> + - sophgo,syscon
>> +
>> +additionalProperties: false
>> +
>> +examples:
>> + - |
>> + reserved-memory {
>> + #address-cells = <1>;
>> + #size-cells = <1>;
>> + ranges;
>> +
>> + c906l_mem: region@83f40000 {
>> + reg = <0x83f40000 0xc0000>;
>> + no-map;
>> + };
>> + };
>> +
>> + c906l-rproc {
>> + compatible = "sophgo,cv1800b-c906l";
>> + firmware-name = "c906l-firmware.elf";
>> + memory-region = <&c906l_mem>;
>> + resets = <&rst 294>;
>> + sophgo,syscon = <&sec_sys>;
>> + };
>>
--
Best regards,
Junhui Liu
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] dt-bindings: remoteproc: Add C906L rproc for Sophgo CV1800B SoC
2025-06-08 2:37 ` [PATCH 1/2] dt-bindings: remoteproc: Add C906L rproc for Sophgo CV1800B SoC Junhui Liu
2025-06-11 9:01 ` Chen Wang
@ 2025-06-25 19:16 ` Rob Herring
2025-06-29 3:19 ` Junhui Liu
1 sibling, 1 reply; 11+ messages in thread
From: Rob Herring @ 2025-06-25 19:16 UTC (permalink / raw)
To: Junhui Liu
Cc: Bjorn Andersson, Mathieu Poirier, Krzysztof Kozlowski,
Conor Dooley, Chen Wang, Inochi Amaoto, Philipp Zabel,
Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
linux-remoteproc, devicetree, sophgo, linux-kernel, linux-riscv
On Sun, Jun 08, 2025 at 10:37:39AM +0800, Junhui Liu wrote:
> Add C906L remote processor for CV1800B SoC, which is an asymmetric
> processor typically running RTOS.
>
> Signed-off-by: Junhui Liu <junhui.liu@pigmoral.tech>
> ---
> .../bindings/remoteproc/sophgo,cv1800b-c906l.yaml | 68 ++++++++++++++++++++++
> 1 file changed, 68 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/remoteproc/sophgo,cv1800b-c906l.yaml b/Documentation/devicetree/bindings/remoteproc/sophgo,cv1800b-c906l.yaml
> new file mode 100644
> index 0000000000000000000000000000000000000000..455e957dec01c16424c49ebe5ef451883b0c3d4a
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/remoteproc/sophgo,cv1800b-c906l.yaml
> @@ -0,0 +1,68 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/remoteproc/sophgo,cv1800b-c906l.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Sophgo C906L remote processor controller for CV1800B SoC
> +
> +maintainers:
> + - Junhui Liu <junhui.liu@pigmoral.tech>
> +
> +description:
> + Document the bindings for the C906L remoteproc component that loads and boots
> + firmwares on the CV1800B SoC.
> +
> +properties:
> + compatible:
> + const: sophgo,cv1800b-c906l
> +
> + firmware-name:
> + $ref: /schemas/types.yaml#/definitions/string
Already has a type. You just need 'maxItems: 1'.
> + description:
> + The name of the firmware file to load for this remote processor, relative
> + to the firmware search path (typically /lib/firmware/).
That's the same for every 'firmware-name' instance. So drop.
Is there a default name?
> +
> + memory-region:
maxItems: 1
> + description:
> + Phandle to a reserved memory region that is used to load the firmware for
> + this remote processor. The remote processor will use this memory region
> + as its execution memory.
> +
> + resets:
> + maxItems: 1
> +
> + sophgo,syscon:
> + $ref: /schemas/types.yaml#/definitions/phandle
> + description:
> + A phandle to the SEC_SYS region, used for configuration of the remote processor.
> +
> +required:
> + - compatible
> + - firmware-name
> + - memory-region
> + - resets
> + - sophgo,syscon
> +
> +additionalProperties: false
> +
> +examples:
> + - |
> + reserved-memory {
> + #address-cells = <1>;
> + #size-cells = <1>;
> + ranges;
> +
> + c906l_mem: region@83f40000 {
> + reg = <0x83f40000 0xc0000>;
> + no-map;
> + };
> + };
Drop. No need to show how /reserved-memory works here.
> +
> + c906l-rproc {
> + compatible = "sophgo,cv1800b-c906l";
> + firmware-name = "c906l-firmware.elf";
> + memory-region = <&c906l_mem>;
> + resets = <&rst 294>;
> + sophgo,syscon = <&sec_sys>;
> + };
>
> --
> 2.49.0
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] dt-bindings: remoteproc: Add C906L rproc for Sophgo CV1800B SoC
2025-06-25 19:16 ` Rob Herring
@ 2025-06-29 3:19 ` Junhui Liu
0 siblings, 0 replies; 11+ messages in thread
From: Junhui Liu @ 2025-06-29 3:19 UTC (permalink / raw)
To: Rob Herring
Cc: Bjorn Andersson, Mathieu Poirier, Krzysztof Kozlowski,
Conor Dooley, Chen Wang, Inochi Amaoto, Philipp Zabel,
Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
linux-remoteproc, devicetree, sophgo, linux-kernel, linux-riscv
Hi Rob,
Thanks for your review.
On 25/06/2025 14:16, Rob Herring wrote:
> On Sun, Jun 08, 2025 at 10:37:39AM +0800, Junhui Liu wrote:
>> Add C906L remote processor for CV1800B SoC, which is an asymmetric
>> processor typically running RTOS.
>>
>> Signed-off-by: Junhui Liu <junhui.liu@pigmoral.tech>
>> ---
>> .../bindings/remoteproc/sophgo,cv1800b-c906l.yaml | 68 ++++++++++++++++++++++
>> 1 file changed, 68 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/remoteproc/sophgo,cv1800b-c906l.yaml b/Documentation/devicetree/bindings/remoteproc/sophgo,cv1800b-c906l.yaml
>> new file mode 100644
>> index 0000000000000000000000000000000000000000..455e957dec01c16424c49ebe5ef451883b0c3d4a
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/remoteproc/sophgo,cv1800b-c906l.yaml
>> @@ -0,0 +1,68 @@
>> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/remoteproc/sophgo,cv1800b-c906l.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: Sophgo C906L remote processor controller for CV1800B SoC
>> +
>> +maintainers:
>> + - Junhui Liu <junhui.liu@pigmoral.tech>
>> +
>> +description:
>> + Document the bindings for the C906L remoteproc component that loads and boots
>> + firmwares on the CV1800B SoC.
>> +
>> +properties:
>> + compatible:
>> + const: sophgo,cv1800b-c906l
>> +
>> + firmware-name:
>> + $ref: /schemas/types.yaml#/definitions/string
>
> Already has a type. You just need 'maxItems: 1'.
Will do.
>
>> + description:
>> + The name of the firmware file to load for this remote processor, relative
>> + to the firmware search path (typically /lib/firmware/).
>
> That's the same for every 'firmware-name' instance. So drop.
>
> Is there a default name?
The firmware name would be specified in the board device tree, and
there is no default value. For reference, an example value is provided
in the example DT.
>
>> +
>> + memory-region:
>
> maxItems: 1
I plan to add a description for the rpmsg-related regions in the next
version. Since the number of these regions may be flexible, I think I
will only add a minItems property to ensure the execution memory
region is specified.
>
>> + description:
>> + Phandle to a reserved memory region that is used to load the firmware for
>> + this remote processor. The remote processor will use this memory region
>> + as its execution memory.
>> +
>> + resets:
>> + maxItems: 1
>> +
>> + sophgo,syscon:
>> + $ref: /schemas/types.yaml#/definitions/phandle
>> + description:
>> + A phandle to the SEC_SYS region, used for configuration of the remote processor.
>> +
>> +required:
>> + - compatible
>> + - firmware-name
>> + - memory-region
>> + - resets
>> + - sophgo,syscon
>> +
>> +additionalProperties: false
>> +
>> +examples:
>> + - |
>> + reserved-memory {
>> + #address-cells = <1>;
>> + #size-cells = <1>;
>> + ranges;
>> +
>> + c906l_mem: region@83f40000 {
>> + reg = <0x83f40000 0xc0000>;
>> + no-map;
>> + };
>> + };
>
> Drop. No need to show how /reserved-memory works here.
Will do.
>
>> +
>> + c906l-rproc {
>> + compatible = "sophgo,cv1800b-c906l";
>> + firmware-name = "c906l-firmware.elf";
>> + memory-region = <&c906l_mem>;
>> + resets = <&rst 294>;
>> + sophgo,syscon = <&sec_sys>;
>> + };
>>
>>
--
Best regards,
Junhui Liu
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2025-06-29 3:19 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-08 2:37 [PATCH 0/2] remoteproc: cv1800b: Add initial support for C906L processor Junhui Liu
2025-06-08 2:37 ` [PATCH 1/2] dt-bindings: remoteproc: Add C906L rproc for Sophgo CV1800B SoC Junhui Liu
2025-06-11 9:01 ` Chen Wang
2025-06-11 9:23 ` Junhui Liu
2025-06-25 19:16 ` Rob Herring
2025-06-29 3:19 ` Junhui Liu
2025-06-08 2:37 ` [PATCH 2/2] drivers: remoteproc: Add C906L controller " Junhui Liu
2025-06-09 8:43 ` Peng Fan
2025-06-10 3:42 ` Junhui Liu
2025-06-11 6:29 ` Peng Fan
2025-06-10 5:15 ` kernel test robot
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).