shithub: n900

Download patch

ref: f6fcd88cdb2a2d1fccb1b400c099faa15495b441
parent: cb6c8f7c8de6838b41012db42e9d0141270b32be
author: mia soweli <inbox@tachibana-labs.org>
date: Tue Sep 12 15:57:27 EDT 2023

uart: timeout waiting for reset in uartenable

--- a/sys/src/9/omap/uartomap.c
+++ b/sys/src/9/omap/uartomap.c
@@ -151,13 +151,21 @@
 omapuartenable(Uart *uart, int ie)
 {
 	Ctlr *ctlr;
+	int i;
 
 	ctlr = uart->regs;
 	ilock(ctlr);
 
 	csr32w(ctlr, Rsysc, SCreset);
-	while(!(csr32r(ctlr, Rsyss) & SSreset))
-		;
+	for(i = 0; i < 100; i++) {
+		if(csr32r(ctlr, Rsyss) & SSreset)
+			break;
+	}
+
+	if(i == 100) {
+		iunlock(ctlr);
+		return;
+	}
 
 	csr32w(ctlr, Rfcr, FCRen);
 	if(ie) {