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

Devarsh Thakkar devarsht at ti.com
Fri May 10 14:20:54 CEST 2024


On 09/05/24 19:50, Hari Nagalla wrote:
> AM62A has a R5F core in MCU voltage domain.
> Extend support for R5F remote proc driver on AM62A with compatible
> strings.
> 
> Signed-off-by: Hari Nagalla <hnagalla at ti.com>

Reviewed-by: Devarsh Thakkar <devarsht at ti.com>

Regards
Devarsh

> ---
>  drivers/remoteproc/ti_k3_r5f_rproc.c | 29 ++++++++++++++++++++++++++--
>  1 file changed, 27 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/remoteproc/ti_k3_r5f_rproc.c b/drivers/remoteproc/ti_k3_r5f_rproc.c
> index 631e548dcc..35835b2d61 100644
> --- a/drivers/remoteproc/ti_k3_r5f_rproc.c
> +++ b/drivers/remoteproc/ti_k3_r5f_rproc.c
> @@ -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"},
>  	{}
>  };
>  


More information about the U-Boot mailing list