diff options
author | Hans de Goede <hdegoede@redhat.com> | 2014-12-08 13:38:21 +0100 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2015-01-14 14:56:37 +0100 |
commit | 07f4fe7d7d94b03204dabd40b548bed4f796894c (patch) | |
tree | d6f5cf88a708b2bf6e9e617fe44636d0b2fa3e13 /arch/arm/include | |
parent | 1aac47bd1bf8f1f4a5f12bf7c8e06a18e5b649b4 (diff) |
sunxi: Move await_completion dram helper to dram.h
The await_completion helper is already copy pasted between the sun4i and sun6i
dram code, and we need it for sun8i too, so lets make it an inline helper in
dram.h, rather then adding yet another copy.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
Diffstat (limited to 'arch/arm/include')
-rw-r--r-- | arch/arm/include/asm/arch-sunxi/dram.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/arch/arm/include/asm/arch-sunxi/dram.h b/arch/arm/include/asm/arch-sunxi/dram.h index 9072e68229..18924f5c9c 100644 --- a/arch/arm/include/asm/arch-sunxi/dram.h +++ b/arch/arm/include/asm/arch-sunxi/dram.h @@ -12,6 +12,7 @@ #ifndef _SUNXI_DRAM_H #define _SUNXI_DRAM_H +#include <asm/io.h> #include <linux/types.h> /* dram regs definition */ @@ -23,4 +24,17 @@ unsigned long sunxi_dram_init(void); +/* + * Wait up to 1s for value to be set in given part of reg. + */ +static inline void mctl_await_completion(u32 *reg, u32 mask, u32 val) +{ + unsigned long tmo = timer_get_us() + 1000000; + + while ((readl(reg) & mask) != val) { + if (timer_get_us() > tmo) + panic("Timeout initialising DRAM\n"); + } +} + #endif /* _SUNXI_DRAM_H */ |