2 * linux/include/asm-m68k/cf_io.h
4 * Copyright 2007-2009 Freescale Semiconductor, Inc. All Rights Reserved.
5 * 9/30/08 JKM - Separated Coldfire pieces out from m68k.
13 #include <linux/compiler.h>
14 #include <asm/raw_io.h>
15 #include <asm/virtconvert.h>
17 #include <asm-generic/iomap.h>
20 * These should be valid on any ioremap()ed region
22 #define readb(addr) in_8(addr)
23 #define writeb(val,addr) out_8((addr),(val))
24 #define readw(addr) in_le16(addr)
25 #define writew(val,addr) out_le16((addr),(val))
26 #define readl(addr) in_le32(addr)
27 #define writel(val,addr) out_le32((addr),(val))
29 #define readb_relaxed(addr) readb(addr)
30 #define readw_relaxed(addr) readw(addr)
31 #define readl_relaxed(addr) readl(addr)
36 * IO space in Coldfire
38 /*#define HAVE_ARCH_PIO_SIZE 1
39 #define PIO_OFFSET 0x00000000UL
40 #define PIO_RESERVED 0x100000000UL
41 #define PIO_MASK (PIO_RESERVED - 1)
50 #ifndef CONFIG_COLDFIRE
51 #define inb(port) in_8(port)
52 #define outb(val,port) out_8((port),(val))
53 #define inw(port) in_le16(port)
54 #define outw(val,port) out_le16((port),(val))
55 #define inl(port) in_le32(port)
56 #define outl(val,port) out_le32((port),(val))
57 #define insb(port, buf, nr) \
58 raw_insb((u8 *)(port), (u8 *)(buf), (nr))
59 #define outsb(port, buf, nr) \
60 raw_outsb((u8 *)(port), (u8 *)(buf), (nr))
61 #define insw(port, buf, nr) \
62 raw_insw_swapw((u16 *)(port), (u16 *)(buf), (nr))
63 #define outsw(port, buf, nr) \
64 raw_outsw_swapw((u16 *)(port), (u16 *)(buf), (nr))
65 #define insl(port, buf, nr) \
66 raw_insw_swapw((u16 *)(port), (u16 *)(buf), (nr)<<1)
67 #define outsl(port, buf, nr) \
68 raw_outsw_swapw((u16 *)(port), (u16 *)(buf), (nr)<<1)
70 #define inb(port) pci_inb(port)
71 #define outb(val, port) pci_outb((val), (port))
72 #define inw(port) pci_inw(port)
73 #define outw(val, port) pci_outw((val), (port))
74 #define insb(a, b, c) \
75 pci_insb((volatile unsigned char *)a, (unsigned char *)b, c)
76 #define insw(a, b, c) \
77 pci_insw((volatile unsigned short *)a, (const unsigned short *)b, c)
78 #define insl(a, b, c) \
79 pci_insl((volatile unsigned long *)a, (const unsigned long *)b, c)
80 #define outsb(a, b, c) \
81 pci_outsb((volatile unsigned char *)a, (const unsigned char *)b, c)
82 #define outsw(a, b, c) \
83 pci_outsw((volatile unsigned short *)a, (const unsigned short *)b, c)
84 #define outsl(a, b, c) \
85 pci_outsl((volatile unsigned long *)a, (const unsigned long *)b, c)
86 #define inl(port) pci_inl(port)
87 #define outl(val, port) pci_outl((val), (port))
93 #define inb(port) in_8(port)
94 #define outb(val, port) out_8((port), (val))
95 #define inw(port) in_le16(port)
96 #define outw(val, port) out_le16((port), (val))
97 #define inl(port) in_le32(port)
98 #define outl(val, port) out_le32((port), (val))
99 #define insb(port, buf, nr) \
100 raw_insb((u8 *)(port), (u8 *)(buf), (nr))
101 #define outsb(port, buf, nr) \
102 raw_outsb((u8 *)(port), (u8 *)(buf), (nr))
103 #define insw(port, buf, nr) \
104 raw_insw_swapw((u16 *)(port), (u16 *)(buf), (nr))
105 #define outsw(port, buf, nr) \
106 raw_outsw_swapw((u16 *)(port), (u16 *)(buf), (nr))
107 #define insl(port, buf, nr) \
108 raw_insw_swapw((u16 *)(port), (u16 *)(buf), (nr)<<1)
109 #define outsl(port, buf, nr) \
110 raw_outsw_swapw((u16 *)(port), (u16 *)(buf), (nr)<<1)
112 #endif /* CONFIG_PCI */
116 static inline void __iomem
*ioremap(unsigned long physaddr
, unsigned long size
)
118 return __ioremap(physaddr
, size
, IOMAP_NOCACHE_SER
);
120 static inline void __iomem
*ioremap_nocache(unsigned long physaddr
, unsigned long size
)
122 return __ioremap(physaddr
, size
, IOMAP_NOCACHE_SER
);
124 static inline void __iomem
*ioremap_writethrough(unsigned long physaddr
,
127 return __ioremap(physaddr
, size
, IOMAP_WRITETHROUGH
);
129 static inline void __iomem
*ioremap_fullcache(unsigned long physaddr
,
132 return __ioremap(physaddr
, size
, IOMAP_FULL_CACHING
);
135 static inline void memset_io(volatile void __iomem
*addr
, unsigned char val
, int count
)
137 __builtin_memset((void __force
*) addr
, val
, count
);
139 static inline void memcpy_fromio(void *dst
, const volatile void __iomem
*src
, int count
)
141 __builtin_memcpy(dst
, (void __force
*) src
, count
);
143 static inline void memcpy_toio(volatile void __iomem
*dst
, const void *src
, int count
)
145 __builtin_memcpy((void __force
*) dst
, src
, count
);
148 #define IO_SPACE_LIMIT 0xffffffff
150 #endif /* __KERNEL__ */
152 #define __ARCH_HAS_NO_PAGE_ZERO_MAPPED 1
155 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
158 #define xlate_dev_mem_ptr(p) __va(p)
161 * Convert a virtual cached pointer to an uncached pointer
163 #define xlate_dev_kmem_ptr(p) p
165 #define __raw_readb(addr) \
166 ({ unsigned char __v = (*(volatile unsigned char *) (addr)); __v; })
167 #define __raw_readw(addr) \
168 ({ unsigned short __v = (*(volatile unsigned short *) (addr)); __v; })
169 #define __raw_readl(addr) \
170 ({ unsigned long __v = (*(volatile unsigned long *) (addr)); __v; })
171 #define __raw_writeb(b,addr) (void)((*(volatile unsigned char *) (addr)) = (b))
172 #define __raw_writew(b,addr) (void)((*(volatile unsigned short *) (addr)) = (b))
173 #define __raw_writel(b,addr) (void)((*(volatile unsigned int *) (addr)) = (b))
175 #define memset_io(a, b, c) memset((void *)(a), (b), (c))
176 #define memcpy_fromio(a, b, c) memcpy((a), (void *)(b), (c))
177 #define memcpy_toio(a, b, c) memcpy((void *)(a), (b), (c))
180 #define readb(addr) \
181 ({ unsigned char __v = (*(volatile unsigned char *) (addr)); __v; })
182 #define readw(addr) \
183 ({ unsigned short __v = (*(volatile unsigned short *) (addr)); __v; })
184 #define readl(addr) \
185 ({ unsigned int __v = (*(volatile unsigned int *) (addr)); __v; })
186 #define writeb(b, addr) (void)((*(volatile unsigned char *) (addr)) = (b))
187 #define writew(b, addr) (void)((*(volatile unsigned short *) (addr)) = (b))
188 #define writel(b, addr) (void)((*(volatile unsigned int *) (addr)) = (b))
This page took 0.049601 seconds and 5 git commands to generate.