summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
437bc42)
Due to a missing 'volatile' in the get_cr() function, the asm
instruction may be optimized away by the compiler.
This bug has been papered over with a delay loop after reading the
CP15 control register.
Fix the asm statement and remove the bogus workaround.
static inline unsigned int get_cr(void)
{
unsigned int val;
static inline unsigned int get_cr(void)
{
unsigned int val;
- asm("mrc p15, 0, %0, c1, c0, 0 @ get CR" : "=r" (val) : : "cc");
+ asm volatile("mrc p15, 0, %0, c1, c0, 0 @ get CR"
+ : "=r" (val) : : "cc");
static inline unsigned int get_dacr(void)
{
unsigned int val;
static inline unsigned int get_dacr(void)
{
unsigned int val;
- asm("mrc p15, 0, %0, c3, c0, 0 @ get DACR" : "=r" (val) : : "cc");
+ asm volatile("mrc p15, 0, %0, c3, c0, 0 @ get DACR"
+ : "=r" (val) : : "cc");
-static void cp_delay (void)
-{
- volatile int i;
-
- /* copro seems to need some delay between reading and writing */
- for (i = 0; i < 100; i++)
- nop();
- asm volatile("" : : : "memory");
-}
-
void set_section_dcache(int section, enum dcache_option option)
{
u32 *page_table = (u32 *)gd->arch.tlb_addr;
void set_section_dcache(int section, enum dcache_option option)
{
u32 *page_table = (u32 *)gd->arch.tlb_addr;
/* and enable the mmu */
reg = get_cr(); /* get control reg. */
/* and enable the mmu */
reg = get_cr(); /* get control reg. */
if ((cache_bit == CR_C) && !mmu_enabled())
mmu_setup();
reg = get_cr(); /* get control reg. */
if ((cache_bit == CR_C) && !mmu_enabled())
mmu_setup();
reg = get_cr(); /* get control reg. */
set_cr(reg | cache_bit);
}
set_cr(reg | cache_bit);
}
uint32_t reg;
reg = get_cr();
uint32_t reg;
reg = get_cr();
if (cache_bit == CR_C) {
/* if cache isn;t enabled no need to disable */
if (cache_bit == CR_C) {
/* if cache isn;t enabled no need to disable */
cache_bit |= CR_M;
}
reg = get_cr();
cache_bit |= CR_M;
}
reg = get_cr();
if (cache_bit == (CR_C | CR_M))
flush_dcache_all();
set_cr(reg & ~cache_bit);
if (cache_bit == (CR_C | CR_M))
flush_dcache_all();
set_cr(reg & ~cache_bit);