Skip to contentSkip to conversation

Add remoteproc driver for AM62a SoC

PATCH In review Hari Nagalla 3 participants 10 messages May 9, 2024 – May 15, 2024 Remote processor (remoteproc)

lore
Share & tools
lore
#0 lore raw

cover Add remoteproc driver for AM62a SoC

This series adds relevant ip data in remoteproc driver for AM62a devices.

Logs: https://paste.sr.ht/~hnagalla/5e20838705c1d688bca81886dad56451b56d3913

Hari Nagalla (4):
remoteproc: k3-dsp: Enable C71x support for AM62A
remoteproc: k3-r5: Add support for R5F core on AM62A SoCs
configs: am62ax: enable remote proc drivers
board: ti: am62ax: Add support for remote proc load

 board/ti/am62ax/am62ax.env           |  4 ++++
 configs/am62ax_evm_a53_defconfig     |  3 +++
 drivers/remoteproc/ti_k3_dsp_rproc.c | 13 +++++++++++--
 drivers/remoteproc/ti_k3_r5f_rproc.c | 29 ++++++++++++++++++++++++++--
 4 files changed, 45 insertions(+), 4 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/4 remoteproc: k3-dsp: Enable C71x support for AM62A

AM62A SoC has a single C71x DSP subsystem with analytics engine in main voltage domain. Extend support to AM62A with compatible strings.

---
 drivers/remoteproc/ti_k3_dsp_rproc.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/remoteproc/ti_k3_dsp_rproc.c +11 -2
index e790406324..ed13729c33 100644
@@ -339,7 +339,8 @@ static int k3_dsp_of_get_memories(struct udevice *dev)
 	for (i = 0; i < dsp->num_mems; i++) {
 		/* C71 cores only have a L1P Cache, there are no L1P SRAMs */
 		if (((device_is_compatible(dev, "ti,j721e-c71-dsp")) ||
-		     (device_is_compatible(dev, "ti,j721s2-c71-dsp"))) &&
+		    (device_is_compatible(dev, "ti,j721s2-c71-dsp")) ||
+		    (device_is_compatible(dev, "ti,am62a-c7xv-dsp"))) &&
 		    !strcmp(mem_names[i], "l1pram")) {
 			dsp->mem[i].bus_addr = FDT_ADDR_T_NONE;
 			dsp->mem[i].dev_addr = FDT_ADDR_T_NONE;
@@ -347,7 +348,14 @@ static int k3_dsp_of_get_memories(struct udevice *dev)
 			dsp->mem[i].size = 0;
 			continue;
 		}
-
+		if (device_is_compatible(dev, "ti,am62a-c7xv-dsp") &&
+		    !strcmp(mem_names[i], "l1dram")) {
+			dsp->mem[i].bus_addr = FDT_ADDR_T_NONE;
+			dsp->mem[i].dev_addr = FDT_ADDR_T_NONE;
+			dsp->mem[i].cpu_addr = NULL;
+			dsp->mem[i].size = 0;
+			continue;
+		}
 		dsp->mem[i].bus_addr = dev_read_addr_size_name(dev, mem_names[i],
 					  (fdt_addr_t *)&dsp->mem[i].size);
 		if (dsp->mem[i].bus_addr == FDT_ADDR_T_NONE) {
@@ -459,6 +467,7 @@ static const struct udevice_id k3_dsp_ids[] = {
 	{ .compatible = "ti,j721e-c66-dsp", .data = (ulong)&c66_data, },
 	{ .compatible = "ti,j721e-c71-dsp", .data = (ulong)&c71_data, },
 	{ .compatible = "ti,j721s2-c71-dsp", .data = (ulong)&c71_data, },
+	{ .compatible = "ti,am62a-c7xv-dsp", .data = (ulong)&c71_data, },
 	{}
 };
 
Signature · 1 line
2.34.1
Reviewed-by on v1 1/4
#2 lore raw

Re: [PATCH 1/4] remoteproc: k3-dsp: Enable C71x support for AM62A

Quoted 4 lines · Hari Nagalla

AM62A SoC has a single C71x DSP subsystem with analytics engine in main voltage domain. Extend support to AM62A with compatible strings.

Regards
Devarsh

Quoted 42 lines
---
 drivers/remoteproc/ti_k3_dsp_rproc.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/remoteproc/ti_k3_dsp_rproc.c +11 -2
index e790406324..ed13729c33 100644
@@ -339,7 +339,8 @@ static int k3_dsp_of_get_memories(struct udevice *dev)
 	for (i = 0; i < dsp->num_mems; i++) {
 		/* C71 cores only have a L1P Cache, there are no L1P SRAMs */
 		if (((device_is_compatible(dev, "ti,j721e-c71-dsp")) ||
-		     (device_is_compatible(dev, "ti,j721s2-c71-dsp"))) &&
+		    (device_is_compatible(dev, "ti,j721s2-c71-dsp")) ||
+		    (device_is_compatible(dev, "ti,am62a-c7xv-dsp"))) &&
 		    !strcmp(mem_names[i], "l1pram")) {
 			dsp->mem[i].bus_addr = FDT_ADDR_T_NONE;
 			dsp->mem[i].dev_addr = FDT_ADDR_T_NONE;
@@ -347,7 +348,14 @@ static int k3_dsp_of_get_memories(struct udevice *dev)
 			dsp->mem[i].size = 0;
 			continue;
 		}
-
+		if (device_is_compatible(dev, "ti,am62a-c7xv-dsp") &&
+		    !strcmp(mem_names[i], "l1dram")) {
+			dsp->mem[i].bus_addr = FDT_ADDR_T_NONE;
+			dsp->mem[i].dev_addr = FDT_ADDR_T_NONE;
+			dsp->mem[i].cpu_addr = NULL;
+			dsp->mem[i].size = 0;
+			continue;
+		}
 		dsp->mem[i].bus_addr = dev_read_addr_size_name(dev, mem_names[i],
 					  (fdt_addr_t *)&dsp->mem[i].size);
 		if (dsp->mem[i].bus_addr == FDT_ADDR_T_NONE) {
@@ -459,6 +467,7 @@ static const struct udevice_id k3_dsp_ids[] = {
 	{ .compatible = "ti,j721e-c66-dsp", .data = (ulong)&c66_data, },
 	{ .compatible = "ti,j721e-c71-dsp", .data = (ulong)&c71_data, },
 	{ .compatible = "ti,j721s2-c71-dsp", .data = (ulong)&c71_data, },
+	{ .compatible = "ti,am62a-c7xv-dsp", .data = (ulong)&c71_data, },
 	{}
 };
 
#3 lore raw

PATCH 2/4 remoteproc: k3-r5: Add support for R5F core on AM62A SoCs

In reply to Hari Nagalla

AM62A has a R5F core in MCU voltage domain.
Extend support for R5F remote proc driver on AM62A with compatible strings.

---
 drivers/remoteproc/ti_k3_r5f_rproc.c | 29 ++++++++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)
drivers/remoteproc/ti_k3_r5f_rproc.c +27 -2
index 631e548dcc..35835b2d61 100644
@@ -40,6 +40,8 @@
 #define PROC_BOOT_CFG_FLAG_GEN_IGN_BOOTVECTOR		0x10000000
 /* Available from J7200 SoCs onwards */
 #define PROC_BOOT_CFG_FLAG_R5_MEM_INIT_DIS		0x00004000
+#define PROC_BOOT_CFG_FLAG_R5_SINGLE_CORE		0x00008000
+
 
 /* R5 TI-SCI Processor Control Flags */
 #define PROC_BOOT_CTRL_FLAG_R5_CORE_HALT		0x00000001
@@ -55,6 +57,8 @@
 enum cluster_mode {
 	CLUSTER_MODE_SPLIT = 0,
 	CLUSTER_MODE_LOCKSTEP,
+	CLUSTER_MODE_SINGLECPU,
+	CLUSTER_MODE_SINGLECORE,
 };
 
 /**
@@ -65,6 +69,7 @@ enum cluster_mode {
 struct k3_r5f_ip_data {
 	bool tcm_is_double;
 	bool tcm_ecc_autoinit;
+	bool is_single_core;
 };
 
 /**
@@ -599,8 +604,10 @@ static int k3_r5f_rproc_configure(struct k3_r5f_core *core)
 	/* Sanity check for Lockstep mode */
 	lockstep_permitted = !!(sts &
 				PROC_BOOT_STATUS_FLAG_R5_LOCKSTEP_PERMITTED);
-	if (cluster->mode && is_primary_core(core) && !lockstep_permitted) {
-		dev_err(core->dev, "LockStep mode not permitted on this device\n");
+	if (cluster->mode == CLUSTER_MODE_LOCKSTEP && is_primary_core(core) &&
+	    !lockstep_permitted) {
+		dev_err(core->dev, "LockStep mode not permitted on this \
+			device\n");
 		ret = -EINVAL;
 		goto out;
 	}
@@ -615,6 +622,9 @@ static int k3_r5f_rproc_configure(struct k3_r5f_core *core)
 			clr_cfg |= PROC_BOOT_CFG_FLAG_R5_LOCKSTEP;
 	}
 
+	if (core->ipdata->is_single_core)
+		set_cfg = PROC_BOOT_CFG_FLAG_R5_SINGLE_CORE;
+
 	if (core->atcm_enable)
 		set_cfg |= PROC_BOOT_CFG_FLAG_R5_ATCM_EN;
 	else
@@ -853,11 +863,19 @@ static int k3_r5f_remove(struct udevice *dev)
 static const struct k3_r5f_ip_data k3_data = {
 	.tcm_is_double = false,
 	.tcm_ecc_autoinit = false,
+	.is_single_core = false,
 };
 
 static const struct k3_r5f_ip_data j7200_j721s2_data = {
 	.tcm_is_double = true,
 	.tcm_ecc_autoinit = true,
+	.is_single_core = false,
+};
+
+static const struct k3_r5f_ip_data am62_data = {
+	.tcm_is_double = false,
+	.tcm_ecc_autoinit = false,
+	.is_single_core = true,
 };
 
 static const struct udevice_id k3_r5f_rproc_ids[] = {
@@ -865,6 +883,7 @@ static const struct udevice_id k3_r5f_rproc_ids[] = {
 	{ .compatible = "ti,j721e-r5f", .data = (ulong)&k3_data, },
 	{ .compatible = "ti,j7200-r5f", .data = (ulong)&j7200_j721s2_data, },
 	{ .compatible = "ti,j721s2-r5f", .data = (ulong)&j7200_j721s2_data, },
+	{ .compatible = "ti,am62-r5f", .data = (ulong)&am62_data, },
 	{}
 };
 
@@ -887,6 +906,11 @@ static int k3_r5f_cluster_probe(struct udevice *dev)
 	cluster->mode = dev_read_u32_default(dev, "ti,cluster-mode",
 					     CLUSTER_MODE_LOCKSTEP);
 
+	if (device_is_compatible(dev, "ti,am62-r5fss")) {
+		cluster->mode = CLUSTER_MODE_SINGLECORE;
+		return 0;
+	}
+
 	if (device_get_child_count(dev) != 2) {
 		dev_err(dev, "Invalid number of R5 cores");
 		return -EINVAL;
@@ -903,6 +927,7 @@ static const struct udevice_id k3_r5fss_ids[] = {
 	{ .compatible = "ti,j721e-r5fss"},
 	{ .compatible = "ti,j7200-r5fss"},
 	{ .compatible = "ti,j721s2-r5fss"},
+	{ .compatible = "ti,am62-r5fss"},
 	{}
 };
 
Signature · 1 line
2.34.1
Reviewed-by on v1 2/4
#4 lore raw

Re: [PATCH 2/4] remoteproc: k3-r5: Add support for R5F core on AM62A SoCs

Quoted 5 lines · Hari Nagalla

AM62A has a R5F core in MCU voltage domain.
Extend support for R5F remote proc driver on AM62A with compatible strings.

Regards
Devarsh

Quoted 105 lines
---
 drivers/remoteproc/ti_k3_r5f_rproc.c | 29 ++++++++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)
drivers/remoteproc/ti_k3_r5f_rproc.c +27 -2
index 631e548dcc..35835b2d61 100644
@@ -40,6 +40,8 @@
 #define PROC_BOOT_CFG_FLAG_GEN_IGN_BOOTVECTOR		0x10000000
 /* Available from J7200 SoCs onwards */
 #define PROC_BOOT_CFG_FLAG_R5_MEM_INIT_DIS		0x00004000
+#define PROC_BOOT_CFG_FLAG_R5_SINGLE_CORE		0x00008000
+
 
 /* R5 TI-SCI Processor Control Flags */
 #define PROC_BOOT_CTRL_FLAG_R5_CORE_HALT		0x00000001
@@ -55,6 +57,8 @@
 enum cluster_mode {
 	CLUSTER_MODE_SPLIT = 0,
 	CLUSTER_MODE_LOCKSTEP,
+	CLUSTER_MODE_SINGLECPU,
+	CLUSTER_MODE_SINGLECORE,
 };
 
 /**
@@ -65,6 +69,7 @@ enum cluster_mode {
 struct k3_r5f_ip_data {
 	bool tcm_is_double;
 	bool tcm_ecc_autoinit;
+	bool is_single_core;
 };
 
 /**
@@ -599,8 +604,10 @@ static int k3_r5f_rproc_configure(struct k3_r5f_core *core)
 	/* Sanity check for Lockstep mode */
 	lockstep_permitted = !!(sts &
 				PROC_BOOT_STATUS_FLAG_R5_LOCKSTEP_PERMITTED);
-	if (cluster->mode && is_primary_core(core) && !lockstep_permitted) {
-		dev_err(core->dev, "LockStep mode not permitted on this device\n");
+	if (cluster->mode == CLUSTER_MODE_LOCKSTEP && is_primary_core(core) &&
+	    !lockstep_permitted) {
+		dev_err(core->dev, "LockStep mode not permitted on this \
+			device\n");
 		ret = -EINVAL;
 		goto out;
 	}
@@ -615,6 +622,9 @@ static int k3_r5f_rproc_configure(struct k3_r5f_core *core)
 			clr_cfg |= PROC_BOOT_CFG_FLAG_R5_LOCKSTEP;
 	}
 
+	if (core->ipdata->is_single_core)
+		set_cfg = PROC_BOOT_CFG_FLAG_R5_SINGLE_CORE;
+
 	if (core->atcm_enable)
 		set_cfg |= PROC_BOOT_CFG_FLAG_R5_ATCM_EN;
 	else
@@ -853,11 +863,19 @@ static int k3_r5f_remove(struct udevice *dev)
 static const struct k3_r5f_ip_data k3_data = {
 	.tcm_is_double = false,
 	.tcm_ecc_autoinit = false,
+	.is_single_core = false,
 };
 
 static const struct k3_r5f_ip_data j7200_j721s2_data = {
 	.tcm_is_double = true,
 	.tcm_ecc_autoinit = true,
+	.is_single_core = false,
+};
+
+static const struct k3_r5f_ip_data am62_data = {
+	.tcm_is_double = false,
+	.tcm_ecc_autoinit = false,
+	.is_single_core = true,
 };
 
 static const struct udevice_id k3_r5f_rproc_ids[] = {
@@ -865,6 +883,7 @@ static const struct udevice_id k3_r5f_rproc_ids[] = {
 	{ .compatible = "ti,j721e-r5f", .data = (ulong)&k3_data, },
 	{ .compatible = "ti,j7200-r5f", .data = (ulong)&j7200_j721s2_data, },
 	{ .compatible = "ti,j721s2-r5f", .data = (ulong)&j7200_j721s2_data, },
+	{ .compatible = "ti,am62-r5f", .data = (ulong)&am62_data, },
 	{}
 };
 
@@ -887,6 +906,11 @@ static int k3_r5f_cluster_probe(struct udevice *dev)
 	cluster->mode = dev_read_u32_default(dev, "ti,cluster-mode",
 					     CLUSTER_MODE_LOCKSTEP);
 
+	if (device_is_compatible(dev, "ti,am62-r5fss")) {
+		cluster->mode = CLUSTER_MODE_SINGLECORE;
+		return 0;
+	}
+
 	if (device_get_child_count(dev) != 2) {
 		dev_err(dev, "Invalid number of R5 cores");
 		return -EINVAL;
@@ -903,6 +927,7 @@ static const struct udevice_id k3_r5fss_ids[] = {
 	{ .compatible = "ti,j721e-r5fss"},
 	{ .compatible = "ti,j7200-r5fss"},
 	{ .compatible = "ti,j721s2-r5fss"},
+	{ .compatible = "ti,am62-r5fss"},
 	{}
 };
 
#5 lore raw

PATCH 3/4 configs: am62ax: enable remote proc drivers

In reply to Hari Nagalla

Enable K3-DSP and K3-R5FSS remote proc drivers for am62ax.

---
 configs/am62ax_evm_a53_defconfig | 3 +++
 1 file changed, 3 insertions(+)
configs/am62ax_evm_a53_defconfig +3 -0
index c4556f5dd2..6b29a4b9cf 100644
@@ -72,6 +72,8 @@ CONFIG_POWER_DOMAIN=y
 CONFIG_TI_SCI_POWER_DOMAIN=y
 CONFIG_K3_SYSTEM_CONTROLLER=y
 CONFIG_REMOTEPROC_TI_K3_ARM64=y
+CONFIG_REMOTEPROC_TI_K3_R5F=y
+CONFIG_REMOTEPROC_TI_K3_DSP=y
 CONFIG_RESET_TI_SCI=y
 CONFIG_DM_SERIAL=y
 CONFIG_SOC_DEVICE=y
@@ -81,3 +83,4 @@ CONFIG_SYSRESET=y
 CONFIG_SPL_SYSRESET=y
 CONFIG_SYSRESET_TI_SCI=y
 CONFIG_FS_FAT_MAX_CLUSTSIZE=16384
+CONFIG_CMD_REMOTEPROC=y
Signature · 1 line
2.34.1
Reviewed-by on v1 3/4
#6 lore raw

Re: [PATCH 3/4] configs: am62ax: enable remote proc drivers

Quoted 3 lines · Hari Nagalla

Enable K3-DSP and K3-R5FSS remote proc drivers for am62ax.

Regards
Devarsh

Quoted 22 lines
---
 configs/am62ax_evm_a53_defconfig | 3 +++
 1 file changed, 3 insertions(+)
configs/am62ax_evm_a53_defconfig +3 -0
index c4556f5dd2..6b29a4b9cf 100644
@@ -72,6 +72,8 @@ CONFIG_POWER_DOMAIN=y
 CONFIG_TI_SCI_POWER_DOMAIN=y
 CONFIG_K3_SYSTEM_CONTROLLER=y
 CONFIG_REMOTEPROC_TI_K3_ARM64=y
+CONFIG_REMOTEPROC_TI_K3_R5F=y
+CONFIG_REMOTEPROC_TI_K3_DSP=y
 CONFIG_RESET_TI_SCI=y
 CONFIG_DM_SERIAL=y
 CONFIG_SOC_DEVICE=y
@@ -81,3 +83,4 @@ CONFIG_SYSRESET=y
 CONFIG_SPL_SYSRESET=y
 CONFIG_SYSRESET_TI_SCI=y
 CONFIG_FS_FAT_MAX_CLUSTSIZE=16384
+CONFIG_CMD_REMOTEPROC=y
#7 lore raw

PATCH 4/4 board: ti: am62ax: Add support for remote proc load

In reply to Hari Nagalla

Add AM62a remote proc firmware names to environment variables for loading of C7x DSP and R5F processors.

---
 board/ti/am62ax/am62ax.env | 4 ++++
 1 file changed, 4 insertions(+)
board/ti/am62ax/am62ax.env +4 -0
index 334374abb7..97122fb57b 100644
@@ -1,5 +1,8 @@
 #include <env/ti/ti_common.env>
 #include <env/ti/mmc.env>
+#if CONFIG_CMD_REMOTEPROC
+#include <env/ti/k3_rproc.env>
+#endif
 
 name_kern=Image
 console=ttyS2,115200n8
@@ -27,3 +30,4 @@ get_kern_mmc=load mmc ${bootpart} ${loadaddr}
 get_fit_mmc=load mmc ${bootpart} ${addr_fit}
 	${bootdir}/${name_fit}
 partitions=name=rootfs,start=0,size=-,uuid=${uuid_gpt_rootfs}
+rproc_fw_binaries= 0 /lib/firmware/am62a-mcu-r5f0_0-fw 1 /lib/firmware/am62a-c71_0-fw
Signature · 1 line
2.34.1
Reviewed-by on v1 4/4
#8 lore raw

Re: [PATCH 4/4] board: ti: am62ax: Add support for remote proc load

Quoted 4 lines · Hari Nagalla

Add AM62a remote proc firmware names to environment variables for loading of C7x DSP and R5F processors.

Regards
Devarsh

Quoted 22 lines
---
 board/ti/am62ax/am62ax.env | 4 ++++
 1 file changed, 4 insertions(+)
board/ti/am62ax/am62ax.env +4 -0
index 334374abb7..97122fb57b 100644
@@ -1,5 +1,8 @@
 #include <env/ti/ti_common.env>
 #include <env/ti/mmc.env>
+#if CONFIG_CMD_REMOTEPROC
+#include <env/ti/k3_rproc.env>
+#endif
 
 name_kern=Image
 console=ttyS2,115200n8
@@ -27,3 +30,4 @@ get_kern_mmc=load mmc ${bootpart} ${loadaddr}
 get_fit_mmc=load mmc ${bootpart} ${addr_fit}
 	${bootdir}/${name_fit}
 partitions=name=rootfs,start=0,size=-,uuid=${uuid_gpt_rootfs}
+rproc_fw_binaries= 0 /lib/firmware/am62a-mcu-r5f0_0-fw 1 /lib/firmware/am62a-c71_0-fw
#9 lore raw
In reply to Hari Nagalla
Quoted 11 lines · Hari Nagalla

This series adds relevant ip data in remoteproc driver for AM62a devices.

Logs: https://paste.sr.ht/~hnagalla/5e20838705c1d688bca81886dad56451b56d3913

Hari Nagalla (4):
remoteproc: k3-dsp: Enable C71x support for AM62A
remoteproc: k3-r5: Add support for R5F core on AM62A SoCs
configs: am62ax: enable remote proc drivers
board: ti: am62ax: Add support for remote proc load

[...]

Applied to u-boot/next, thanks!

Signature · 1 line
Tom