1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * MTD primitives for XIP support. Architecture specific functions
4  *
5  * Do not include this file directly. It's included from linux/mtd/xip.h
6  *
7  * Author:	Nicolas Pitre
8  * Created:	Nov 2, 2004
9  * Copyright:	(C) 2004 MontaVista Software, Inc.
10  */
11 
12 #ifndef __ARCH_PXA_MTD_XIP_H__
13 #define __ARCH_PXA_MTD_XIP_H__
14 
15 #include <mach/regs-ost.h>
16 
17 /* restored July 2017, this did not build since 2011! */
18 
19 #define ICIP			io_p2v(0x40d00000)
20 #define ICMR			io_p2v(0x40d00004)
21 #define xip_irqpending()	(readl(ICIP) & readl(ICMR))
22 
23 /* we sample OSCR and convert desired delta to usec (1/4 ~= 1000000/3686400) */
24 #define xip_currtime()		readl(OSCR)
25 #define xip_elapsed_since(x)	(signed)((readl(OSCR) - (x)) / 4)
26 
27 /*
28  * xip_cpu_idle() is used when waiting for a delay equal or larger than
29  * the system timer tick period.  This should put the CPU into idle mode
30  * to save power and to be woken up only when some interrupts are pending.
31  * As above, this should not rely upon standard kernel code.
32  */
33 
34 #define xip_cpu_idle()  asm volatile ("mcr p14, 0, %0, c7, c0, 0" :: "r" (1))
35 
36 #endif /* __ARCH_PXA_MTD_XIP_H__ */
37