From: Jason Jin Date: Tue, 19 Apr 2011 14:15:32 +0800 Subject: [U-Boot] [PATCH 7/9] ColdFire:Add mb for 5253 dram initialization In-Reply-To: <1303193734-29075-7-git-send-email-Jason.jin@freescale.com> References: <1303193734-29075-1-git-send-email-Jason.jin@freescale.com> <1303193734-29075-2-git-send-email-Jason.jin@freescale.com> <1303193734-29075-3-git-send-email-Jason.jin@freescale.com> <1303193734-29075-4-git-send-email-Jason.jin@freescale.com> <1303193734-29075-5-git-send-email-Jason.jin@freescale.com> <1303193734-29075-6-git-send-email-Jason.jin@freescale.com> <1303193734-29075-7-git-send-email-Jason.jin@freescale.com> Message-ID: <1303193734-29075-8-git-send-email-Jason.jin@freescale.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de The dram initialization sequence should be in order. This patch add mb for the dram intialization code to make sure the compiler do not disorder the code. Signed-off-by: Jason Jin --- arch/m68k/include/asm/io.h | 2 ++ board/freescale/m5253demo/m5253demo.c | 4 ++++ 2 files changed, 6 insertions(+), 0 deletions(-) diff --git a/arch/m68k/include/asm/io.h b/arch/m68k/include/asm/io.h index 531f420..d86eaf9 100644 --- a/arch/m68k/include/asm/io.h +++ b/arch/m68k/include/asm/io.h @@ -81,6 +81,8 @@ #define outl(val, port) out_le32((u32 *)((port)+_IO_BASE), (val)) #endif +#define mb() __asm__ __volatile__ ("" : : : "memory") + extern inline void _insb(volatile u8 * port, void *buf, int ns) { u8 *data = (u8 *) buf; diff --git a/board/freescale/m5253demo/m5253demo.c b/board/freescale/m5253demo/m5253demo.c index 4772074..8ffb2cc 100644 --- a/board/freescale/m5253demo/m5253demo.c +++ b/board/freescale/m5253demo/m5253demo.c @@ -27,6 +27,7 @@ #include #include #include +#include int checkboard(void) { @@ -63,10 +64,12 @@ phys_size_t initdram(int board_type) __asm__("nop"); mbar_writeLong(MCFSIM_DACR0, 0x0000322c); + mb(); __asm__("nop"); /* Write to this block to initiate precharge */ *(u32 *) (CONFIG_SYS_SDRAM_BASE) = 0xa5a5a5a5; + mb(); __asm__("nop"); /* Set RE bit in DACR */ @@ -83,6 +86,7 @@ phys_size_t initdram(int board_type) __asm__("nop"); *(u32 *) (CONFIG_SYS_SDRAM_BASE + 0x800) = 0xa5a5a5a5; + mb(); } return dramsize; -- 1.6.4