Path: blob/master/arch/arm/mach-omap1/include/mach/mtd-xip.h
10820 views
/*1* MTD primitives for XIP support. Architecture specific functions.2*3* Do not include this file directly. It's included from linux/mtd/xip.h4*5* Author: Vladimir Barinov <[email protected]>6*7* (c) 2005 MontaVista Software, Inc. This file is licensed under the8* terms of the GNU General Public License version 2. This program is9* licensed "as is" without any warranty of any kind, whether express or10* implied.11*/1213#ifndef __ARCH_OMAP_MTD_XIP_H__14#define __ARCH_OMAP_MTD_XIP_H__1516#include <mach/hardware.h>17#define OMAP_MPU_TIMER_BASE (0xfffec500)18#define OMAP_MPU_TIMER_OFFSET 0x1001920typedef struct {21u32 cntl; /* CNTL_TIMER, R/W */22u32 load_tim; /* LOAD_TIM, W */23u32 read_tim; /* READ_TIM, R */24} xip_omap_mpu_timer_regs_t;2526#define xip_omap_mpu_timer_base(n) \27((volatile xip_omap_mpu_timer_regs_t*)OMAP1_IO_ADDRESS(OMAP_MPU_TIMER_BASE + \28(n)*OMAP_MPU_TIMER_OFFSET))2930static inline unsigned long xip_omap_mpu_timer_read(int nr)31{32volatile xip_omap_mpu_timer_regs_t* timer = xip_omap_mpu_timer_base(nr);33return timer->read_tim;34}3536#define xip_irqpending() \37(omap_readl(OMAP_IH1_ITR) & ~omap_readl(OMAP_IH1_MIR))38#define xip_currtime() (~xip_omap_mpu_timer_read(0))3940/*41* It's permitted to do approxmation for xip_elapsed_since macro42* (see linux/mtd/xip.h)43*/4445#ifdef CONFIG_MACH_OMAP_PERSEUS246#define xip_elapsed_since(x) (signed)((~xip_omap_mpu_timer_read(0) - (x)) / 7)47#else48#define xip_elapsed_since(x) (signed)((~xip_omap_mpu_timer_read(0) - (x)) / 6)49#endif5051/*52* xip_cpu_idle() is used when waiting for a delay equal or larger than53* the system timer tick period. This should put the CPU into idle mode54* to save power and to be woken up only when some interrupts are pending.55* As above, this should not rely upon standard kernel code.56*/5758#define xip_cpu_idle() asm volatile ("mcr p15, 0, %0, c7, c0, 4" :: "r" (1))5960#endif /* __ARCH_OMAP_MTD_XIP_H__ */616263