Commit a6b974b4 authored by Tanmay Shah's avatar Tanmay Shah Committed by Mathieu Poirier

drivers: remoteproc: xlnx: Add Versal and Versal-NET support

AMD-Xilinx Versal platform is successor of ZynqMP platform.
Real-time Processing Unit R5 cluster IP on Versal is same as
of ZynqMP Platform. Power-domains ids for Versal platform is
different than ZynqMP.

AMD-Xilinx Versal-NET platform is successor of Versal platform.
Versal-NET Real-Time Processing Unit has two clusters and each
cluster contains dual core ARM Cortex-R52 processors. Each R52
core is assigned 128KB of TCM memory.
Signed-off-by: default avatarTanmay Shah <tanmay.shah@amd.com>
Link: https://lore.kernel.org/r/20240418220125.744322-1-tanmay.shah@amd.comSigned-off-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
parent 72c350c9
...@@ -300,36 +300,6 @@ static void zynqmp_r5_rproc_kick(struct rproc *rproc, int vqid) ...@@ -300,36 +300,6 @@ static void zynqmp_r5_rproc_kick(struct rproc *rproc, int vqid)
dev_warn(dev, "failed to send message\n"); dev_warn(dev, "failed to send message\n");
} }
/*
* zynqmp_r5_set_mode()
*
* set RPU cluster and TCM operation mode
*
* @r5_core: pointer to zynqmp_r5_core type object
* @fw_reg_val: value expected by firmware to configure RPU cluster mode
* @tcm_mode: value expected by fw to configure TCM mode (lockstep or split)
*
* Return: 0 for success and < 0 for failure
*/
static int zynqmp_r5_set_mode(struct zynqmp_r5_core *r5_core,
enum rpu_oper_mode fw_reg_val,
enum rpu_tcm_comb tcm_mode)
{
int ret;
ret = zynqmp_pm_set_rpu_mode(r5_core->pm_domain_id, fw_reg_val);
if (ret < 0) {
dev_err(r5_core->dev, "failed to set RPU mode\n");
return ret;
}
ret = zynqmp_pm_set_tcm_config(r5_core->pm_domain_id, tcm_mode);
if (ret < 0)
dev_err(r5_core->dev, "failed to configure TCM\n");
return ret;
}
/* /*
* zynqmp_r5_rproc_start() * zynqmp_r5_rproc_start()
* @rproc: single R5 core's corresponding rproc instance * @rproc: single R5 core's corresponding rproc instance
...@@ -941,7 +911,7 @@ static int zynqmp_r5_core_init(struct zynqmp_r5_cluster *cluster, ...@@ -941,7 +911,7 @@ static int zynqmp_r5_core_init(struct zynqmp_r5_cluster *cluster,
/* Maintain backward compatibility for zynqmp by using hardcode TCM address. */ /* Maintain backward compatibility for zynqmp by using hardcode TCM address. */
if (of_find_property(r5_core->np, "reg", NULL)) if (of_find_property(r5_core->np, "reg", NULL))
ret = zynqmp_r5_get_tcm_node_from_dt(cluster); ret = zynqmp_r5_get_tcm_node_from_dt(cluster);
else else if (device_is_compatible(dev, "xlnx,zynqmp-r5fss"))
ret = zynqmp_r5_get_tcm_node(cluster); ret = zynqmp_r5_get_tcm_node(cluster);
if (ret) { if (ret) {
...@@ -960,12 +930,21 @@ static int zynqmp_r5_core_init(struct zynqmp_r5_cluster *cluster, ...@@ -960,12 +930,21 @@ static int zynqmp_r5_core_init(struct zynqmp_r5_cluster *cluster,
return ret; return ret;
} }
ret = zynqmp_r5_set_mode(r5_core, fw_reg_val, tcm_mode); ret = zynqmp_pm_set_rpu_mode(r5_core->pm_domain_id, fw_reg_val);
if (ret) { if (ret < 0) {
dev_err(dev, "failed to set r5 cluster mode %d, err %d\n", dev_err(r5_core->dev, "failed to set RPU mode\n");
cluster->mode, ret);
return ret; return ret;
} }
if (of_find_property(dev_of_node(dev), "xlnx,tcm-mode", NULL) ||
device_is_compatible(dev, "xlnx,zynqmp-r5fss")) {
ret = zynqmp_pm_set_tcm_config(r5_core->pm_domain_id,
tcm_mode);
if (ret < 0) {
dev_err(r5_core->dev, "failed to configure TCM\n");
return ret;
}
}
} }
return 0; return 0;
...@@ -1022,7 +1001,7 @@ static int zynqmp_r5_cluster_init(struct zynqmp_r5_cluster *cluster) ...@@ -1022,7 +1001,7 @@ static int zynqmp_r5_cluster_init(struct zynqmp_r5_cluster *cluster)
ret = of_property_read_u32(dev_node, "xlnx,tcm-mode", (u32 *)&tcm_mode); ret = of_property_read_u32(dev_node, "xlnx,tcm-mode", (u32 *)&tcm_mode);
if (ret) if (ret)
return ret; return ret;
} else { } else if (device_is_compatible(dev, "xlnx,zynqmp-r5fss")) {
if (cluster_mode == LOCKSTEP_MODE) if (cluster_mode == LOCKSTEP_MODE)
tcm_mode = PM_RPU_TCM_COMB; tcm_mode = PM_RPU_TCM_COMB;
else else
...@@ -1212,6 +1191,8 @@ static int zynqmp_r5_remoteproc_probe(struct platform_device *pdev) ...@@ -1212,6 +1191,8 @@ static int zynqmp_r5_remoteproc_probe(struct platform_device *pdev)
/* Match table for OF platform binding */ /* Match table for OF platform binding */
static const struct of_device_id zynqmp_r5_remoteproc_match[] = { static const struct of_device_id zynqmp_r5_remoteproc_match[] = {
{ .compatible = "xlnx,versal-net-r52fss", },
{ .compatible = "xlnx,versal-r5fss", },
{ .compatible = "xlnx,zynqmp-r5fss", }, { .compatible = "xlnx,zynqmp-r5fss", },
{ /* end of list */ }, { /* end of list */ },
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment