Skip to content

Commit 3c8a906

Browse files
3V3RYONEmathieupoirier
authored andcommitted
remoteproc: k3-r5: Do not allow core1 to power up before core0 via sysfs
PSC controller has a limitation that it can only power-up the second core when the first core is in ON state. Power-state for core0 should be equal to or higher than core1. Therefore, prevent core1 from powering up before core0 during the start process from sysfs. Similarly, prevent core0 from shutting down before core1 has been shut down from sysfs. Fixes: 6dedbd1 ("remoteproc: k3-r5: Add a remoteproc driver for R5F subsystem") Signed-off-by: Beleswar Padhi <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mathieu Poirier <[email protected]>
1 parent 61f6f68 commit 3c8a906

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

drivers/remoteproc/ti_k3_r5_remoteproc.c

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ static int k3_r5_rproc_start(struct rproc *rproc)
548548
struct k3_r5_rproc *kproc = rproc->priv;
549549
struct k3_r5_cluster *cluster = kproc->cluster;
550550
struct device *dev = kproc->dev;
551-
struct k3_r5_core *core;
551+
struct k3_r5_core *core0, *core;
552552
u32 boot_addr;
553553
int ret;
554554

@@ -574,6 +574,15 @@ static int k3_r5_rproc_start(struct rproc *rproc)
574574
goto unroll_core_run;
575575
}
576576
} else {
577+
/* do not allow core 1 to start before core 0 */
578+
core0 = list_first_entry(&cluster->cores, struct k3_r5_core,
579+
elem);
580+
if (core != core0 && core0->rproc->state == RPROC_OFFLINE) {
581+
dev_err(dev, "%s: can not start core 1 before core 0\n",
582+
__func__);
583+
return -EPERM;
584+
}
585+
577586
ret = k3_r5_core_run(core);
578587
if (ret)
579588
goto put_mbox;
@@ -619,7 +628,8 @@ static int k3_r5_rproc_stop(struct rproc *rproc)
619628
{
620629
struct k3_r5_rproc *kproc = rproc->priv;
621630
struct k3_r5_cluster *cluster = kproc->cluster;
622-
struct k3_r5_core *core = kproc->core;
631+
struct device *dev = kproc->dev;
632+
struct k3_r5_core *core1, *core = kproc->core;
623633
int ret;
624634

625635
/* halt all applicable cores */
@@ -632,6 +642,15 @@ static int k3_r5_rproc_stop(struct rproc *rproc)
632642
}
633643
}
634644
} else {
645+
/* do not allow core 0 to stop before core 1 */
646+
core1 = list_last_entry(&cluster->cores, struct k3_r5_core,
647+
elem);
648+
if (core != core1 && core1->rproc->state != RPROC_OFFLINE) {
649+
dev_err(dev, "%s: can not stop core 0 before core 1\n",
650+
__func__);
651+
return -EPERM;
652+
}
653+
635654
ret = k3_r5_core_halt(core);
636655
if (ret)
637656
goto out;

0 commit comments

Comments
 (0)