remoteproc: k3-dsp: Avoid reloading of firmware

DSP core is going into abnormal state when load callback is called
after starting of DSP core.
Reload of firmware needs core to be stopped first, followed by
load.
So avoid loading of firmware, when core is started.

Signed-off-by: Udit Kumar <u-kumar1@ti.com>
Reviewed-by: Apurva Nandan <a-nandan@ti.com>
This commit is contained in:
Udit Kumar 2023-11-24 16:19:00 +05:30 committed by Praneeth Bajjuri
parent c97fa5cd4a
commit 3c8e18effc
1 changed files with 11 additions and 1 deletions

View File

@ -57,6 +57,7 @@ struct k3_dsp_boot_data {
* @data: Pointer to DSP specific boot data structure * @data: Pointer to DSP specific boot data structure
* @mem: Array of available memories * @mem: Array of available memories
* @num_mem: Number of available memories * @num_mem: Number of available memories
* @in_use: flag to tell if the core is already in use.
*/ */
struct k3_dsp_privdata { struct k3_dsp_privdata {
struct reset_ctl dsp_rst; struct reset_ctl dsp_rst;
@ -64,6 +65,7 @@ struct k3_dsp_privdata {
struct k3_dsp_boot_data *data; struct k3_dsp_boot_data *data;
struct k3_dsp_mem *mem; struct k3_dsp_mem *mem;
int num_mems; int num_mems;
bool in_use;
}; };
/* /*
@ -130,6 +132,13 @@ static int k3_dsp_load(struct udevice *dev, ulong addr, ulong size)
void *image_addr = (void *)addr; void *image_addr = (void *)addr;
int ret; int ret;
if (dsp->in_use) {
dev_err(dev,
"Invalid op: Trying to load/start on already running core %d\n",
dsp->tsp.proc_id);
return -EINVAL;
}
dev_dbg(dev, "%s addr = 0x%lx, size = 0x%lx\n", __func__, addr, size); dev_dbg(dev, "%s addr = 0x%lx, size = 0x%lx\n", __func__, addr, size);
ret = ti_sci_proc_request(&dsp->tsp); ret = ti_sci_proc_request(&dsp->tsp);
if (ret) if (ret)
@ -198,7 +207,7 @@ static int k3_dsp_start(struct udevice *dev)
if (!data->uses_lreset) if (!data->uses_lreset)
ti_sci_proc_power_domain_off(&dsp->tsp); ti_sci_proc_power_domain_off(&dsp->tsp);
} }
dsp->in_use = true;
proc_release: proc_release:
ti_sci_proc_release(&dsp->tsp); ti_sci_proc_release(&dsp->tsp);
@ -211,6 +220,7 @@ static int k3_dsp_stop(struct udevice *dev)
dev_dbg(dev, "%s\n", __func__); dev_dbg(dev, "%s\n", __func__);
dsp->in_use = false;
ti_sci_proc_request(&dsp->tsp); ti_sci_proc_request(&dsp->tsp);
reset_assert(&dsp->dsp_rst); reset_assert(&dsp->dsp_rst);
ti_sci_proc_power_domain_off(&dsp->tsp); ti_sci_proc_power_domain_off(&dsp->tsp);