From: Scott Wood Date: Fri, 17 Sep 2010 14:10:07 -0500 Subject: [U-Boot] [u-boot-release] [PATCH] [v3] p1022ds: use weak CFI flash accessorswhen DIU is enabled In-Reply-To: <5610599F537DD74A8D1F5CC946A75073034792E2@az33exm25.fsl.freescale.net> References: <1284672944-20033-1-git-send-email-timur@freescale.com> <86B8287A3892574BB48B72D98B2DE56805E3E6@zin33exm24.fsl.freescale.net> <5610599F537DD74A8D1F5CC946A75073034792E2@az33exm25.fsl.freescale.net> Message-ID: <20100917141007.2e7cc6b2@schlenkerla.am.freescale.net> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Thu, 16 Sep 2010 19:51:33 -0700 Tabi Timur-B04825 wrote: > Jaggi Manish-B10520 wrote: > > Most of the read/write functions do this way > > 0:+ int sw = set_mux_to_lbc(); > > 1:+ > > 2:+ ret = __raw_readl(addr); > > 3:+ if (sw) > > 4:+ set_mux_to_diu(); > > > > compiler might reorder 2 before 3 and 0, read / write wont have any > > issue , right ? > > Really? I don't see why the compiler would do that. That would be a bug, IMHO. Only if set_mux_to_lbc() is non-inline, and the compiler has no visibility into what it does. But even then, the hardware is free to reorder. That's why we have non-raw I/O accessors. > Can you explain why you think it will make such a reordering? My > understanding is that the compiler reorders things that don't have any side > effects. The compiler can reorder anything where the reordering won't affect the results of single-threaded execution with no interrupts, well-behaved memory (no device registers, bank switches, etc), no violations of aliasing rules, etc. -Scott