Merge tag 'soc-ep93xx-dt-6.12' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
[linux-2.6-block.git] / arch / xtensa / include / asm / io.h
CommitLineData
9a8fd558 1/*
173d6681 2 * include/asm-xtensa/io.h
9a8fd558
CZ
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_IO_H
12#define _XTENSA_IO_H
13
9a8fd558 14#include <asm/byteorder.h>
c51aea80 15#include <asm/page.h>
4809bb46 16#include <asm/vectors.h>
bfae8ee8 17#include <linux/bug.h>
6656920b 18#include <linux/kernel.h>
ca6c1af3 19#include <linux/pgtable.h>
9a8fd558
CZ
20
21#include <linux/types.h>
9a8fd558 22
00c81d23 23#define IOADDR(x) (XCHAL_KIO_BYPASS_VADDR + (x))
d38efc1f 24#define IO_SPACE_LIMIT ~0
982792f4 25#define PCI_IOBASE ((void __iomem *)XCHAL_KIO_BYPASS_VADDR)
9a8fd558 26
d38efc1f 27#ifdef CONFIG_MMU
9a8fd558 28/*
ca6c1af3 29 * I/O memory mapping functions.
9a8fd558 30 */
ca6c1af3
BH
31void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
32 unsigned long prot);
33#define ioremap_prot ioremap_prot
34#define iounmap iounmap
35
ab53cea4 36static inline void __iomem *ioremap(unsigned long offset, unsigned long size)
9a8fd558 37{
173d6681 38 if (offset >= XCHAL_KIO_PADDR
02f37748 39 && offset - XCHAL_KIO_PADDR < XCHAL_KIO_SIZE)
173d6681 40 return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_BYPASS_VADDR);
173d6681 41 else
ca6c1af3
BH
42 return ioremap_prot(offset, size,
43 pgprot_val(pgprot_noncached(PAGE_KERNEL)));
9a8fd558 44}
ca6c1af3 45#define ioremap ioremap
9a8fd558 46
02f37748
MF
47static inline void __iomem *ioremap_cache(unsigned long offset,
48 unsigned long size)
9a8fd558 49{
173d6681 50 if (offset >= XCHAL_KIO_PADDR
02f37748 51 && offset - XCHAL_KIO_PADDR < XCHAL_KIO_SIZE)
173d6681
CZ
52 return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_CACHED_VADDR);
53 else
ca6c1af3 54 return ioremap_prot(offset, size, pgprot_val(PAGE_KERNEL));
02f37748 55
9a8fd558 56}
ca6c1af3 57#define ioremap_cache ioremap_cache
d38efc1f 58#endif /* CONFIG_MMU */
9a8fd558 59
d38efc1f
MF
60#include <asm-generic/io.h>
61
9a8fd558 62#endif /* _XTENSA_IO_H */