blob: 0e74f19b1eae95c5c6e859be19d670d94f74858a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
/*
* MTD primitives for XIP support. Architecture specific functions
*
* Do not include this file directly. It's included from linux/mtd/xip.h
*
* Copyright (C) 2008 Darius Augulis <augulis.darius@gmail.com>, Teltonika, Inc.
* Copyright 2007-2009 Freescale Semiconductor, Inc. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
*/
#include <linux/clocksource.h>
#include <mach/hardware.h>
#include <mach/system.h>
#include <mach/mxc_timer.h>
#ifndef __ARCH_IMX_MTD_XIP_H__
#define __ARCH_IMX_MTD_XIP_H__
/* AITC registers */
#define AITC_BASE IO_ADDRESS(AVIC_BASE_ADDR)
#define NIPNDH (AITC_BASE + 0x58)
#define NIPNDL (AITC_BASE + 0x5C)
#define INTENABLEH (AITC_BASE + 0x10)
#define INTENABLEL (AITC_BASE + 0x14)
/* MTD macros */
#define xip_irqpending() ((__raw_readl(INTENABLEH) & __raw_readl(NIPNDH)) \
|| (__raw_readl(INTENABLEL) & __raw_readl(NIPNDL)))
#ifdef CONFIG_ARCH_MX1
#define xip_currtime() (__raw_readl(TIMER_BASE + MXC_TCN))
#define xip_elapsed_since(x) (signed)((__raw_readl(TIMER_BASE + MXC_TCN) - (x)) / 96)
#define xip_cpu_idle() asm volatile ("mcr p15, 0, %0, c7, c0, 4" :: "r" (0))
#else
extern struct clocksource *mtd_xip_clksrc;
#define xip_currtime() (unsigned long)clocksource_read(mtd_xip_clksrc)
#if CLOCK_TICK_RATE > 1000000
#define NUMERATOR 1
#define DENOMINATOR (CLOCK_TICK_RATE/1000000 + 1)
#else
#define NUMERATOR (1000000/CLOCK_TICK_RATE)
#define DENOMINATOR 1
#endif
static inline unsigned long xip_elapsed_since(unsigned long x)
{
return (((xip_currtime() - x) * NUMERATOR) / DENOMINATOR);
}
/*
* Wait For Interrupt command for XIP kernel to put CPU in Idle mode
*/
#define xip_cpu_idle() arch_idle()
#endif /* CONFIG_ARCH_MX1 */
#endif /* __ARCH_IMX_MTD_XIP_H__ */
|