io.h 1.7 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 <linux/bug.h>
18
#include <linux/kernel.h>
19 20 21

#include <linux/types.h>

C
Chris Zankel 已提交
22 23
#define XCHAL_KIO_CACHED_VADDR	0xe0000000
#define XCHAL_KIO_BYPASS_VADDR	0xf0000000
24
#define XCHAL_KIO_PADDR		0xf0000000
C
Chris Zankel 已提交
25 26 27
#define XCHAL_KIO_SIZE		0x10000000

#define IOADDR(x)		(XCHAL_KIO_BYPASS_VADDR + (x))
M
Max Filippov 已提交
28
#define IO_SPACE_LIMIT ~0
29

M
Max Filippov 已提交
30
#ifdef CONFIG_MMU
31
/*
M
Max Filippov 已提交
32
 * Return the virtual address for the specified bus memory.
33
 * Note that we currently don't support any address outside the KIO segment.
34
 */
M
Max Filippov 已提交
35 36
static inline void __iomem *ioremap_nocache(unsigned long offset,
		unsigned long size)
37
{
38
	if (offset >= XCHAL_KIO_PADDR
M
Max Filippov 已提交
39
	    && offset - XCHAL_KIO_PADDR < XCHAL_KIO_SIZE)
40 41 42
		return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_BYPASS_VADDR);
	else
		BUG();
43 44
}

M
Max Filippov 已提交
45 46
static inline void __iomem *ioremap_cache(unsigned long offset,
		unsigned long size)
47
{
48
	if (offset >= XCHAL_KIO_PADDR
M
Max Filippov 已提交
49
	    && offset - XCHAL_KIO_PADDR < XCHAL_KIO_SIZE)
50 51 52
		return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_CACHED_VADDR);
	else
		BUG();
53 54
}

M
Max Filippov 已提交
55 56 57 58 59 60 61 62
#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)
63 64
{
}
M
Max Filippov 已提交
65
#endif /* CONFIG_MMU */
66 67 68 69

/*
 * Generic I/O
 */
M
Max Filippov 已提交
70 71 72
#define readb_relaxed readb
#define readw_relaxed readw
#define readl_relaxed readl
73 74 75

#endif	/* __KERNEL__ */

M
Max Filippov 已提交
76 77
#include <asm-generic/io.h>

78
#endif	/* _XTENSA_IO_H */