From: Detlev Zundel Date: Wed, 01 Jul 2009 18:56:18 +0200 Subject: [U-Boot] [PATCH] arm: Kirkwood: Add memory barriers to kwgbe_send/recv In-Reply-To: <20090701171615.2d23daf7@marrow.netinsight.se> (Simon Kagstrom's message of "Wed, 1 Jul 2009 17:16:15 +0200") References: <20090701171615.2d23daf7@marrow.netinsight.se> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Simon, > Add memory barriers to kwgbe_send/recv > > kwgbe_send/recv both have loops waiting for the hardware to set a bit. > GCC 4.3.3 cleverly optimizes this to ... a while(1); loop. This patch > introduces memory barriers to force re-loading of the transmit descriptor. > > mb() wasn't defined for arm, but perhaps it should? You should rather use read/write accessor macros which "do the right thing". Try using readl() for the loop. Memory barriers do not belong into "upper level" code. Cheers Detlev -- X-Windows has to be the most expensive way ever of popping up an Emacs window. -- The UNIX Haters Handbook -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de