diff mbox series

[3/8] macintosh/adb-iop: Adopt bus reset algorithm from via-macii driver

Message ID b63d56ecb6e75f11a0bf02231f3b2db656a528a3.1590880623.git.fthain@telegraphics.com.au (mailing list archive)
State Accepted
Commit 303511edb859b1fbf48b3c1d1d53b33a6ebd2a2b
Headers show
Series Mac ADB IOP driver fixes | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch warning Failed to apply on branch powerpc/merge (00ec79b0b767994422c43792d73ff1327714a73f)
snowpatch_ozlabs/apply_patch warning Failed to apply on branch powerpc/next (30df74d67d48949da87e3a5b57c381763e8fd526)
snowpatch_ozlabs/apply_patch warning Failed to apply on branch linus/master (ffeb595d84811dde16a28b33d8a7cf26d51d51b3)
snowpatch_ozlabs/apply_patch warning Failed to apply on branch powerpc/fixes (2f26ed1764b42a8c40d9c48441c73a70d805decf)
snowpatch_ozlabs/apply_patch warning Failed to apply on branch linux-next (e7b08814b16b80a0bf76eeca16317f8c2ed23b8c)
snowpatch_ozlabs/apply_patch fail Failed to apply to any branch

Commit Message

Finn Thain May 30, 2020, 11:17 p.m. UTC
This algorithm is slightly shorter and avoids the surprising
adb_iop_start() call in adb_iop_poll().

Cc: Joshua Thompson <funaho@jurai.org>
Tested-by: Stan Johnson <userm57@yahoo.com>
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
---
 drivers/macintosh/adb-iop.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)
diff mbox series

Patch

diff --git a/drivers/macintosh/adb-iop.c b/drivers/macintosh/adb-iop.c
index ca3b411b0742..c3089dacf2e2 100644
--- a/drivers/macintosh/adb-iop.c
+++ b/drivers/macintosh/adb-iop.c
@@ -238,24 +238,19 @@  int adb_iop_autopoll(int devs)
 
 void adb_iop_poll(void)
 {
-	if (adb_iop_state == idle)
-		adb_iop_start();
 	iop_ism_irq_poll(ADB_IOP);
 }
 
 int adb_iop_reset_bus(void)
 {
-	struct adb_request req = {
-		.reply_expected = 0,
-		.nbytes = 2,
-		.data = { ADB_PACKET, 0 },
-	};
-
-	adb_iop_write(&req);
-	while (!req.complete) {
-		adb_iop_poll();
-		schedule();
-	}
+	struct adb_request req;
+
+	/* Command = 0, Address = ignored */
+	adb_request(&req, NULL, ADBREQ_NOSEND, 1, ADB_BUSRESET);
+	adb_iop_send_request(&req, 1);
+
+	/* Don't want any more requests during the Global Reset low time. */
+	mdelay(3);
 
 	return 0;
 }