summaryrefslogtreecommitdiff
path: root/cesar/hal/arch/inc/sparc.h
diff options
context:
space:
mode:
authorNĂ©lio Laranjeiro2012-06-07 11:41:20 +0200
committerCyril Jourdan2012-09-20 17:00:12 +0200
commitc295ecf3e7bb0035b4454745478d7dd88f657d0a (patch)
tree9cb4f0f3a15848570953ad79ec37a8e79965ae8c /cesar/hal/arch/inc/sparc.h
parent61388538a8086598a375311258d54cb1be62b8d7 (diff)
cesar/hal/arch: wait for the bridge AHB2MIU to be flushed, refs #3147
Leon needs to wait for the bridge AHB to MIU device to ends the write before continuing any process.
Diffstat (limited to 'cesar/hal/arch/inc/sparc.h')
-rw-r--r--cesar/hal/arch/inc/sparc.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/cesar/hal/arch/inc/sparc.h b/cesar/hal/arch/inc/sparc.h
index 4116a468b8..0ef826bef7 100644
--- a/cesar/hal/arch/inc/sparc.h
+++ b/cesar/hal/arch/inc/sparc.h
@@ -12,6 +12,7 @@
* \brief Sparc specific header.
* \ingroup hal_arch
*/
+#include "hal/arch/platform.h"
#include "hal/arch/inc/regs_addr.h"
@@ -80,6 +81,10 @@
#define ARCH_STACK_DECLARE(name) \
u32 name[8 * 1024] __attribute__ ((aligned (8)))
+/** Register to control the flush of the bridge AHB to MIU. */
+#define ARCH_AHB2MIU_TAG_REG (* (volatile u32 *)ARCH_SYS_APB_BASE_ADDR)
+#define ARCH_AHB2MIU_TAG_REG__LEON 5, 5
+
/** Buffer used in arch_write_buffer_flush. */
extern volatile u32 arch_write_buffer_flush_buf;
@@ -101,6 +106,22 @@ arch_stack_call_func (u8 *stack_begin, u8 *stack_end, void *func, ...);
arch_stack_call_func ((u8 *) (stack), (u8 *) (stack) + sizeof (stack), \
func, ## args)
+/**
+ * Require the flush of the bridge AHB to MIU on MSE500 and wait for the flush
+ * is done.
+ */
+extern inline void
+arch_write_buffer_flush_ahb2miu (void)
+{
+ if (arch_is_mse500 ())
+ {
+ ARCH_AHB2MIU_TAG_REG =
+ BF_SET (ARCH_AHB2MIU_TAG_REG, ARCH_AHB2MIU_TAG_REG__LEON, true);
+ while (BF_GET (ARCH_AHB2MIU_TAG_REG__LEON, ARCH_AHB2MIU_TAG_REG))
+ ;
+ }
+}
+
extern inline void
arch_write_buffer_flush (void)
{
@@ -110,6 +131,8 @@ arch_write_buffer_flush (void)
arch_write_buffer_flush_buf = 0;
arch_write_buffer_flush_buf = 0;
arch_reorder_barrier ();
+ arch_write_buffer_flush_ahb2miu ();
+ arch_reorder_barrier ();
}
#define ARCH_LEON_ASI_LOAD_CACHE 0