unicore32: remove ioremap_cached
[linux-2.6-block.git] / arch / unicore32 / include / asm / io.h
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * linux/arch/unicore32/include/asm/io.h
4  *
5  * Code specific to PKUnity SoC and UniCore ISA
6  *
7  * Copyright (C) 2001-2010 GUAN Xue-tao
8  */
9 #ifndef __UNICORE_IO_H__
10 #define __UNICORE_IO_H__
11
12 #ifdef __KERNEL__
13
14 #include <asm/byteorder.h>
15 #include <asm/memory.h>
16
17 #define PCI_IOBASE      PKUNITY_PCILIO_BASE
18 #include <asm-generic/io.h>
19
20 /*
21  * __uc32_ioremap takes CPU physical address.
22  */
23 extern void __iomem *__uc32_ioremap(unsigned long, size_t);
24 extern void __uc32_iounmap(volatile void __iomem *addr);
25
26 /*
27  * ioremap and friends.
28  *
29  * ioremap takes a PCI memory address, as specified in
30  * Documentation/io-mapping.txt.
31  *
32  */
33 #define ioremap(cookie, size)           __uc32_ioremap(cookie, size)
34 #define ioremap_nocache(cookie, size)   __uc32_ioremap(cookie, size)
35 #define iounmap(cookie)                 __uc32_iounmap(cookie)
36
37 #define readb_relaxed readb
38 #define readw_relaxed readw
39 #define readl_relaxed readl
40
41 #define HAVE_ARCH_PIO_SIZE
42 #define PIO_OFFSET              (unsigned int)(PCI_IOBASE)
43 #define PIO_MASK                (unsigned int)(IO_SPACE_LIMIT)
44 #define PIO_RESERVED            (PIO_OFFSET + PIO_MASK + 1)
45
46 #ifdef CONFIG_STRICT_DEVMEM
47
48 #include <linux/ioport.h>
49 #include <linux/mm.h>
50
51 /*
52  * devmem_is_allowed() checks to see if /dev/mem access to a certain
53  * address is valid. The argument is a physical page number.
54  * We mimic x86 here by disallowing access to system RAM as well as
55  * device-exclusive MMIO regions. This effectively disable read()/write()
56  * on /dev/mem.
57  */
58 static inline int devmem_is_allowed(unsigned long pfn)
59 {
60         if (iomem_is_exclusive(pfn << PAGE_SHIFT))
61                 return 0;
62         if (!page_is_ram(pfn))
63                 return 1;
64         return 0;
65 }
66
67 #endif /* CONFIG_STRICT_DEVMEM */
68
69 #endif  /* __KERNEL__ */
70 #endif  /* __UNICORE_IO_H__ */