svn commit: r276297 - head/sys/arm/broadcom/bcm2835

Luiz Otavio O Souza loos at FreeBSD.org
Sat Dec 27 13:52:34 UTC 2014


Author: loos
Date: Sat Dec 27 13:52:33 2014
New Revision: 276297
URL: https://svnweb.freebsd.org/changeset/base/276297

Log:
  On interrupt handler, save the actual data read from mbox.  The previous
  macro wasn't needed and was being used with swapped arguments which always
  give the same result (0) defeating the overflow check.
  
  On initialization, do not use bcm_mbox_intr() to read the pending messages,
  with the new semaphore based implementation this will lead to semaphore
  being incremented on the channels that contain pending data and will make
  the first read for that channel return stale data.
  
  This fixes the hang that happens on boot while initializing the cpufreq on
  Raspberry Pi.

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_mbox.c

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_mbox.c
==============================================================================
--- head/sys/arm/broadcom/bcm2835/bcm2835_mbox.c	Sat Dec 27 13:17:27 2014	(r276296)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_mbox.c	Sat Dec 27 13:52:33 2014	(r276297)
@@ -76,6 +76,7 @@ __FBSDID("$FreeBSD$");
 	mtx_unlock(&(sc)->lock);	\
 } while(0)
 
+#undef DEBUG
 #ifdef  DEBUG
 #define dprintf(fmt, args...) printf(fmt, ##args)
 #else
@@ -116,7 +117,7 @@ bcm_mbox_intr(void *arg)
 			continue;
 		}
 		dprintf("bcm_mbox_intr: chan %d, data %08x\n", chan, data);
-		sc->msg[chan] = MBOX_MSG(data, 0xf);
+		sc->msg[chan] = msg;
 		sema_post(&sc->sema[chan]);
 	}
 }
@@ -174,7 +175,8 @@ bcm_mbox_attach(device_t dev)
 	}
 
 	/* Read all pending messages */
-	bcm_mbox_intr(sc);
+	while ((mbox_read_4(sc, REG_STATUS) & STATUS_EMPTY) == 0)
+		(void)mbox_read_4(sc, REG_READ);
 
 	mbox_write_4(sc, REG_CONFIG, CONFIG_DATA_IRQ);
 


More information about the svn-src-all mailing list