static void l2x0_flush_range(unsigned long start, unsigned long end) { void __iomem *base = l2x0_base; unsigned long flags; l2x0_lock(&l2x0_lock, flags); start &= ~(CACHE_LINE_SIZE - 1); while (start < end) { unsigned long blk_end = block_end(start, end); debug_writel(0x03); while (start < blk_end) { l2x0_flush_line(start); start += CACHE_LINE_SIZE; } debug_writel(0x00); if (blk_end < end) { l2x0_unlock(&l2x0_lock, flags); l2x0_lock(&l2x0_lock, flags); } } cache_wait(base + L2X0_CLEAN_INV_LINE_PA, 1); cache_sync(); l2x0_unlock(&l2x0_lock, flags); }
static void l2x0_clean_all(void) { void __iomem *base = l2x0_base; unsigned char way; unsigned long flags, value; if (omap_rev() == OMAP4430_REV_ES1_0) { l2x0_lock(&l2x0_lock, flags); debug_writel(0x03); /* Clean all the ways */ for (way = 0; way <= 0xf; way++, value = 0) { value = 1 << way; writel(value, base + L2X0_CLEAN_WAY); cache_wait_always(base + L2X0_CLEAN_WAY, value); cache_sync(); } debug_writel(0x00); l2x0_unlock(&l2x0_lock, flags); } else { /* invalidate all ways */ spin_lock_irqsave(&l2x0_lock, flags); writel(0xff, l2x0_base + L2X0_CLEAN_WAY); cache_wait(l2x0_base + L2X0_CLEAN_WAY, 0xff); cache_sync(); spin_unlock_irqrestore(&l2x0_lock, flags); } }
static void l2x0_cache_sync(void) { unsigned long flags; l2x0_lock(&l2x0_lock, flags); cache_sync(); l2x0_unlock(&l2x0_lock, flags); }
static inline void l2x0_inv_all(void) { unsigned long flags; /* invalidate all ways */ l2x0_lock(&l2x0_lock, flags); writel(0xff, l2x0_base + L2X0_INV_WAY); cache_wait_always(l2x0_base + L2X0_INV_WAY, 0xff); cache_sync(); l2x0_unlock(&l2x0_lock, flags); }
static inline void l2x0_flush_all(void) { unsigned long flags; /* flush all ways */ l2x0_lock(&l2x0_lock, flags); writel(0xff, l2x0_base + L2X0_CLEAN_INV_WAY); cache_wait_always(l2x0_base + L2X0_CLEAN_INV_WAY, 0xff); cache_sync(); l2x0_unlock(&l2x0_lock, flags); }