io.h 1.78 KB
Newer Older
1
/*
2
 * include/asm-xtensa/io.h
3
4
5
6
7
8
9
10
11
12
13
14
15
 *
 * This file is subject to the terms and conditions of the GNU General Public
 * License.  See the file "COPYING" in the main directory of this archive
 * for more details.
 *
 * Copyright (C) 2001 - 2005 Tensilica Inc.
 */

#ifndef _XTENSA_IO_H
#define _XTENSA_IO_H

#ifdef __KERNEL__
#include <asm/byteorder.h>
16
#include <asm/page.h>
17
#include <asm/vectors.h>
18
#include <linux/bug.h>
19
#include <linux/kernel.h>
20
21
22

#include <linux/types.h>

Chris Zankel's avatar
Chris Zankel committed
23
#define IOADDR(x)		(XCHAL_KIO_BYPASS_VADDR + (x))
24
#define IO_SPACE_LIMIT ~0
25

26
#ifdef CONFIG_MMU
27

28
#if XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY && defined(CONFIG_OF)
29
30
31
32
33
34
35
36
extern unsigned long xtensa_kio_paddr;

static inline unsigned long xtensa_get_kio_paddr(void)
{
	return xtensa_kio_paddr;
}
#endif

37
/*
38
 * Return the virtual address for the specified bus memory.
39
 * Note that we currently don't support any address outside the KIO segment.
40
 */
Max Filippov's avatar
Max Filippov committed
41
42
static inline void __iomem *ioremap_nocache(unsigned long offset,
		unsigned long size)
43
{
44
	if (offset >= XCHAL_KIO_PADDR
Max Filippov's avatar
Max Filippov committed
45
	    && offset - XCHAL_KIO_PADDR < XCHAL_KIO_SIZE)
46
47
48
		return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_BYPASS_VADDR);
	else
		BUG();
49
50
}

Max Filippov's avatar
Max Filippov committed
51
52
static inline void __iomem *ioremap_cache(unsigned long offset,
		unsigned long size)
53
{
54
	if (offset >= XCHAL_KIO_PADDR
Max Filippov's avatar
Max Filippov committed
55
	    && offset - XCHAL_KIO_PADDR < XCHAL_KIO_SIZE)
56
57
58
		return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_CACHED_VADDR);
	else
		BUG();
59
60
}

Max Filippov's avatar
Max Filippov committed
61
62
63
64
65
66
67
68
#define ioremap_wc ioremap_nocache

static inline void __iomem *ioremap(unsigned long offset, unsigned long size)
{
	return ioremap_nocache(offset, size);
}

static inline void iounmap(volatile void __iomem *addr)
69
70
{
}
71
72
73
74

#define virt_to_bus     virt_to_phys
#define bus_to_virt     phys_to_virt

75
#endif /* CONFIG_MMU */
76
77
78

#endif	/* __KERNEL__ */

79
80
#include <asm-generic/io.h>

81
#endif	/* _XTENSA_IO_H */