diff mbox series

[v2,09/12] libpdbg: Use sbe control to sreset threads if sbe is available

Message ID 20190704080525.31557-10-amitay@ozlabs.org
State Superseded
Headers show
Series Extend sbefifo driver | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success Successfully applied on branch master (6a4185ca278930693a6edb6d003267f74df3d2e8)
snowpatch_ozlabs/build-multiarch fail Test build-multiarch on branch master

Commit Message

Amitay Isaacs July 4, 2019, 8:05 a.m. UTC
Signed-off-by: Amitay Isaacs <amitay@ozlabs.org>
---
 libpdbg/chip.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libpdbg/chip.c b/libpdbg/chip.c
index 03de44f..5fee5ce 100644
--- a/libpdbg/chip.c
+++ b/libpdbg/chip.c
@@ -156,8 +156,19 @@  int thread_sreset(struct pdbg_target *thread_target)
 
 int thread_sreset_all(void)
 {
-	struct pdbg_target *thread;
-	int rc = 0;
+	struct pdbg_target *sbefifo, *thread;
+	int rc = 0, count = 0;
+
+	pdbg_for_each_class_target("sbefifo", sbefifo) {
+		if (pdbg_target_probe(sbefifo) != PDBG_TARGET_ENABLED)
+			continue;
+
+		rc |= sbe_control(sbefifo, 0xff, 0xf, 0x3);
+		count++;
+	}
+
+	if (count > 0)
+		return rc;
 
 	pdbg_for_each_class_target("thread", thread) {
 		rc |= thread_sreset(thread);