Commit | Line | Data |
---|---|---|
96f1050d | 1 | /* |
cfbf1677 | 2 | * Copyright 2004-2010 Analog Devices Inc. |
96f1050d RG |
3 | * |
4 | * Licensed under the GPL-2 or later. | |
5 | */ | |
6 | ||
1394f032 BW |
7 | #ifndef _BFIN_IO_H |
8 | #define _BFIN_IO_H | |
9 | ||
1394f032 | 10 | #include <linux/compiler.h> |
cfbf1677 MF |
11 | #include <linux/types.h> |
12 | #include <asm/byteorder.h> | |
13 | ||
14 | #define DECLARE_BFIN_RAW_READX(size, type, asm, asm_sign) \ | |
15 | static inline type __raw_read##size(const volatile void __iomem *addr) \ | |
16 | { \ | |
17 | unsigned int val; \ | |
18 | int tmp; \ | |
19 | __asm__ __volatile__ ( \ | |
20 | "cli %1;" \ | |
21 | "NOP; NOP; SSYNC;" \ | |
22 | "%0 = "#asm" [%2] "#asm_sign";" \ | |
23 | "sti %1;" \ | |
24 | : "=d"(val), "=d"(tmp) \ | |
25 | : "a"(addr) \ | |
26 | ); \ | |
27 | return (type) val; \ | |
1394f032 | 28 | } |
cfbf1677 MF |
29 | DECLARE_BFIN_RAW_READX(b, u8, b, (z)) |
30 | #define __raw_readb __raw_readb | |
31 | DECLARE_BFIN_RAW_READX(w, u16, w, (z)) | |
32 | #define __raw_readw __raw_readw | |
33 | DECLARE_BFIN_RAW_READX(l, u32, , ) | |
34 | #define __raw_readl __raw_readl | |
1394f032 | 35 | |
b7b2d344 BW |
36 | extern void outsb(unsigned long port, const void *addr, unsigned long count); |
37 | extern void outsw(unsigned long port, const void *addr, unsigned long count); | |
59069676 | 38 | extern void outsw_8(unsigned long port, const void *addr, unsigned long count); |
b7b2d344 | 39 | extern void outsl(unsigned long port, const void *addr, unsigned long count); |
cfbf1677 MF |
40 | #define outsb outsb |
41 | #define outsw outsw | |
42 | #define outsl outsl | |
1394f032 | 43 | |
b7b2d344 BW |
44 | extern void insb(unsigned long port, void *addr, unsigned long count); |
45 | extern void insw(unsigned long port, void *addr, unsigned long count); | |
59069676 | 46 | extern void insw_8(unsigned long port, void *addr, unsigned long count); |
b7b2d344 | 47 | extern void insl(unsigned long port, void *addr, unsigned long count); |
5c91fb90 | 48 | extern void insl_16(unsigned long port, void *addr, unsigned long count); |
cfbf1677 MF |
49 | #define insb insb |
50 | #define insw insw | |
51 | #define insl insl | |
23ee968d | 52 | |
b7b2d344 BW |
53 | extern void dma_outsb(unsigned long port, const void *addr, unsigned short count); |
54 | extern void dma_outsw(unsigned long port, const void *addr, unsigned short count); | |
55 | extern void dma_outsl(unsigned long port, const void *addr, unsigned short count); | |
23ee968d | 56 | |
b7b2d344 BW |
57 | extern void dma_insb(unsigned long port, void *addr, unsigned short count); |
58 | extern void dma_insw(unsigned long port, void *addr, unsigned short count); | |
59 | extern void dma_insl(unsigned long port, void *addr, unsigned short count); | |
1394f032 | 60 | |
cfbf1677 MF |
61 | /** |
62 | * I/O write barrier | |
63 | * | |
64 | * Ensure ordering of I/O space writes. This will make sure that writes | |
65 | * following the barrier will arrive after all previous writes. | |
1394f032 | 66 | */ |
cfbf1677 | 67 | #define mmiowb() do { SSYNC(); wmb(); } while (0) |
1394f032 | 68 | |
cfbf1677 | 69 | #include <asm-generic/io.h> |
1394f032 BW |
70 | |
71 | #endif |