2 * linux/include/asm-m68k/cf_raw_io.h
4 * Copyright 2007-2009 Freescale Semiconductor, Inc. All Rights Reserved.
5 * 09/30/08 JKM: split Coldfire pieces into separate file
12 #include <asm/types.h>
14 /* Values for nocacheflag and cmode */
15 #define IOMAP_FULL_CACHING 0
16 #define IOMAP_NOCACHE_SER 1
17 #define IOMAP_NOCACHE_NONSER 2
18 #define IOMAP_WRITETHROUGH 3
20 extern void iounmap(void __iomem
*addr
);
22 extern void __iomem
*__ioremap(unsigned long physaddr
, unsigned long size
,
24 extern void __iounmap(void *addr
, unsigned long size
);
27 /* ++roman: The assignments to temp. vars avoid that gcc sometimes generates
28 * two accesses to memory, which may be undesirable for some devices.
31 ({ u8 __v = (*(__force volatile u8 *) (addr)); __v; })
32 #define in_be16(addr) \
33 ({ u16 __v = (*(__force volatile u16 *) (addr)); __v; })
34 #define in_be32(addr) \
35 ({ u32 __v = (*(__force volatile u32 *) (addr)); __v; })
36 #define in_le16(addr) \
37 ({ u16 __v = le16_to_cpu(*(__force volatile __le16 *) (addr)); __v; })
38 #define in_le32(addr) \
39 ({ u32 __v = le32_to_cpu(*(__force volatile __le32 *) (addr)); __v; })
41 #define out_8(addr,b) (void)((*(__force volatile u8 *) (addr)) = (b))
42 #define out_be16(addr,w) (void)((*(__force volatile u16 *) (addr)) = (w))
43 #define out_be32(addr,l) (void)((*(__force volatile u32 *) (addr)) = (l))
44 #define out_le16(addr,w) (void)((*(__force volatile __le16 *) (addr)) = cpu_to_le16(w))
45 #define out_le32(addr,l) (void)((*(__force volatile __le32 *) (addr)) = cpu_to_le32(l))
50 unsigned char pci_inb(long addr
);
51 unsigned short pci_inw(long addr
);
52 unsigned long pci_inl(long addr
);
54 void pci_outb(unsigned char val
, long addr
);
55 void pci_outw(unsigned short val
, long addr
);
56 void pci_outl(unsigned long val
, long addr
);
58 void pci_insb(volatile unsigned char *addr
,
59 unsigned char *buf
, int len
);
60 void pci_insw(volatile unsigned short *addr
,
61 unsigned short *buf
, int len
);
62 void pci_insl(volatile unsigned long *addr
,
63 unsigned long *buf
, int len
);
65 void pci_outsb(volatile unsigned char *addr
,
66 const unsigned char *buf
, int len
);
67 void pci_outsw(volatile unsigned short *addr
,
68 const unsigned short *buf
, int len
);
69 void pci_outsl(volatile unsigned long *addr
,
70 const unsigned long *buf
, int len
);
72 unsigned short pci_raw_inw(long addr
);
73 unsigned long pci_raw_inl(long addr
);
74 void pci_raw_outw(unsigned short val
, long addr
);
75 void pci_raw_outl(unsigned long val
, long addr
);
77 #define raw_inb(port) pci_inb((long)((volatile unsigned char *)(port)))
78 #define raw_inw(port) pci_raw_inw((long)((volatile unsigned short *)(port)))
79 #define raw_inl(port) pci_raw_inl((long)((volatile unsigned long *)(port)))
81 #define raw_outb(val, port) \
82 pci_outb((val), (long)((volatile unsigned char *)(port)))
83 #define raw_outw(val, port) \
84 pci_raw_outw((val), (long)((volatile unsigned short *)(port)))
85 #define raw_outl(val, port) \
86 pci_raw_outl((val), (long)((volatile unsigned long *)(port)))
88 #define swap_inw(port) pci_inw((long)((volatile unsigned short *)(port)))
89 #define swap_outw(val, port) \
90 pci_outw((val), (long)((volatile unsigned short *)(port)))
95 #define raw_inw in_be16
96 #define raw_inl in_be32
98 #define raw_outb(val,port) out_8((port),(val))
99 #define raw_outw(val,port) out_be16((port),(val))
100 #define raw_outl(val,port) out_be32((port),(val))
102 #define swap_inw(port) in_le16((port))
103 #define swap_outw(val,port) out_le16((port),(val))
106 static inline void raw_insb(volatile u8 __iomem
*port
, u8
*buf
, unsigned int len
)
110 for (i
= 0; i
< len
; i
++)
114 static inline void raw_outsb(volatile u8 __iomem
*port
, const u8
*buf
,
119 for (i
= 0; i
< len
; i
++)
123 static inline void raw_insw(volatile u16
*port
, u16
*buf
, unsigned int nr
)
127 for (i
= 0; i
< nr
; i
++)
128 *buf
++ = raw_inw(port
);
131 static inline void raw_outsw(volatile u16
*port
, const u16
*buf
,
136 for (i
= 0; i
< nr
; i
++, buf
++)
137 raw_outw(*buf
, port
);
140 static inline void raw_insl(volatile u32
*port
, u32
*buf
, unsigned int nr
)
144 for (i
= 0; i
< nr
; i
++)
145 *buf
++ = raw_inl(port
);
148 static inline void raw_outsl(volatile u32
*port
, const u32
*buf
,
153 for (i
= 0; i
< nr
; i
++, buf
++)
154 raw_outl(*buf
, port
);
157 static inline void raw_insw_swapw(volatile u16
*port
, u16
*buf
,
163 for (i
= 0; i
< nr
; i
++)
164 *buf
++ = in_le16(port
);
168 static inline void raw_outsw_swapw(volatile u16 __iomem
*port
, const u16
*buf
,
174 for (i
= 0; i
< nr
; i
++, buf
++)
175 out_le16(port
, *buf
);
179 #endif /* __KERNEL__ */
181 #endif /* __CF_RAW_IO__ */
This page took 0.077148 seconds and 5 git commands to generate.