0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef __ARCH_OMAP_MTD_XIP_H__
0013 #define __ARCH_OMAP_MTD_XIP_H__
0014
0015 #include "hardware.h"
0016 #include <linux/soc/ti/omap1-io.h>
0017 #define OMAP_MPU_TIMER_BASE (0xfffec500)
0018 #define OMAP_MPU_TIMER_OFFSET 0x100
0019
0020 typedef struct {
0021 u32 cntl;
0022 u32 load_tim;
0023 u32 read_tim;
0024 } xip_omap_mpu_timer_regs_t;
0025
0026 #define xip_omap_mpu_timer_base(n) \
0027 ((volatile xip_omap_mpu_timer_regs_t*)OMAP1_IO_ADDRESS(OMAP_MPU_TIMER_BASE + \
0028 (n)*OMAP_MPU_TIMER_OFFSET))
0029
0030 static inline unsigned long xip_omap_mpu_timer_read(int nr)
0031 {
0032 volatile xip_omap_mpu_timer_regs_t* timer = xip_omap_mpu_timer_base(nr);
0033 return timer->read_tim;
0034 }
0035
0036 #define xip_irqpending() \
0037 (omap_readl(OMAP_IH1_ITR) & ~omap_readl(OMAP_IH1_MIR))
0038 #define xip_currtime() (~xip_omap_mpu_timer_read(0))
0039
0040
0041
0042
0043
0044
0045 #ifdef CONFIG_MACH_OMAP_PERSEUS2
0046 #define xip_elapsed_since(x) (signed)((~xip_omap_mpu_timer_read(0) - (x)) / 7)
0047 #else
0048 #define xip_elapsed_since(x) (signed)((~xip_omap_mpu_timer_read(0) - (x)) / 6)
0049 #endif
0050
0051
0052
0053
0054
0055
0056
0057
0058 #define xip_cpu_idle() asm volatile ("mcr p15, 0, %0, c7, c0, 4" :: "r" (1))
0059
0060 #endif