From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from vs166246.vserver.de (bu3sch.de [62.75.166.246]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id E3D68B7C2B for ; Sun, 1 Nov 2009 03:43:06 +1100 (EST) From: Michael Buesch To: Joakim Tjernlund Subject: Re: Accessing flash directly from User Space [SOLVED] Date: Sat, 31 Oct 2009 17:42:54 +0100 References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Message-Id: <200910311742.56280.mb@bu3sch.de> Cc: "scottwood@freescale.com" , Alessandro Rubini , "bgat@billgatliff.com" , "linuxppc-dev@lists.ozlabs.org" , Jonathan Haws List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Saturday 31 October 2009 14:26:48 Joakim Tjernlund wrote: > > > > > On Friday 30 October 2009 16:08:55 Alessandro Rubini wrote: > > > > > asm("eieio; sync"); > > > > > > > > Hmm... > > > > : : : "memory" > > > > > > > > And, doesn't ";" start a comment in assembly? (no, not on powerpc > > > it seems) > > > > > > Yes, I think the barrier is wrong. > > > Please try with > > > > > > #define mb() __asm__ __volatile__("eieio\n sync\n" : : : > > > "memory") > > > > That definition worked great. I must have missed the : : : "memory" bit when > > I was digging through code. > > > > Thanks, that gives me about a 2x speedup over the msync() calls. > > Exactly when should you use the barrier? At every access, > every read or when changing from write to read? Well, it depends on the device you are accessing. I'll give you a small pseudo example. mmio[0] = address; mmio[1] = data; mb(); mmio[3] |= 0x01; /* This triggers an operation -> address=data */ /* probably also need an mb() here, if the following code * depends on the operation to be triggered. */ -- Greetings, Michael.