Re: [PATCH 1/2] dt-bindings: remoteproc: Add C906L rproc for Sophgo CV1800B SoC
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 >> --- >> .../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 >> ..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 >> + >> +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@83f4 { >> +reg = <0x83f4 0xc>; >> +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
[PATCH 0/2] remoteproc: cv1800b: Add initial support for C906L processor
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-inochi...@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
[PATCH 1/2] dt-bindings: remoteproc: Add C906L rproc for Sophgo CV1800B SoC
Add C906L remote processor for CV1800B SoC, which is an asymmetric processor typically running RTOS. Signed-off-by: Junhui Liu --- .../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 ..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 + +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@83f4 { +reg = <0x83f4 0xc>; +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
[PATCH 2/2] drivers: remoteproc: Add C906L controller for Sophgo CV1800B SoC
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-fd4f1c676...@pigmoral.tech/ [1] Signed-off-by: Junhui Liu --- 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 ..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 + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "remoteproc_internal.h" + +#define CV1800B_SYS_C906L_CTRL_REG 0x04 +#define CV1800B_SYS_C906L_CTRL_ENBIT(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) { +
Re: [PATCH 2/2] drivers: remoteproc: Add C906L controller for Sophgo CV1800B SoC
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-fd4f1c676...@pigmoral.tech/ >> [1] >>Signed-off-by: Junhui Liu >>--- >> 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 >>..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 >>+ */ >>+ >>+#include >>+#include >>+#include >>+#include >>+#include >>+#include >>+#include >>+#include >>+ >>+#include "remoteproc_internal.h" >>+ >>+#define CV1800B_SYS_C906L_CTRL_REG 0x04 >>+#define CV1800B_SYS_C906L_CTRL_EN BIT(13) > > Align the format. > > '#include ' 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, >>+