Example #1
0
void dcache_disable(void)
{
	/* turn off D-cache */
	dcache_stop();

	/* clear and invalidate d-cache */
	dcache_flush_all();

	/* drain write buffer */
	asm("mcr p15, 0, %0, c7, c10, 4": :"r"(0));

	/* invalidate d-cache */
	dcache_inv_all();

	/* disable mmu, d-cache */
	mmu_turnoff();
}
Example #2
0
int cleanup_before_linux(void)
{
	unsigned int i;

	/*
	 * this function is called just before we call linux
	 * it prepares the processor for linux
	 *
	 * we turn off caches etc ...
	 */
	disable_interrupts();

	/* turn off I/D-cache */
	icache_disable();
	dcache_disable();

	/* invalidate I-cache */
	cache_flush();

#ifndef CONFIG_L2_OFF
	/* turn off L2 cache */
	l2cache_disable();
	/* invalidate L2 cache also */
//	v7_flush_dcache_all(get_device_type());
#endif
	i = 0;
	/* mem barrier to sync up things */
	asm("mcr p15, 0, %0, c7, c10, 4": :"r"(i));

#ifndef CONFIG_L2_OFF
	l2cache_enable();
#endif
#ifdef  CFG_MMU_HANDLEOK
        mmu_turnoff();
#endif

	return 0;
}