aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-blackfin/io.h
diff options
context:
space:
mode:
authorBryan Wu <bryan.wu@analog.com>2007-05-06 17:50:22 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-07 15:12:58 -0400
commit1394f03221790a988afc3e4b3cb79f2e477246a9 (patch)
tree2c1963c9a4f2d84a5e021307fde240c5d567cf70 /include/asm-blackfin/io.h
parent73243284463a761e04d69d22c7516b2be7de096c (diff)
blackfin architecture
This adds support for the Analog Devices Blackfin processor architecture, and currently supports the BF533, BF532, BF531, BF537, BF536, BF534, and BF561 (Dual Core) devices, with a variety of development platforms including those avaliable from Analog Devices (BF533-EZKit, BF533-STAMP, BF537-STAMP, BF561-EZKIT), and Bluetechnix! Tinyboards. The Blackfin architecture was jointly developed by Intel and Analog Devices Inc. (ADI) as the Micro Signal Architecture (MSA) core and introduced it in December of 2000. Since then ADI has put this core into its Blackfin processor family of devices. The Blackfin core has the advantages of a clean, orthogonal,RISC-like microprocessor instruction set. It combines a dual-MAC (Multiply/Accumulate), state-of-the-art signal processing engine and single-instruction, multiple-data (SIMD) multimedia capabilities into a single instruction-set architecture. The Blackfin architecture, including the instruction set, is described by the ADSP-BF53x/BF56x Blackfin Processor Programming Reference http://blackfin.uclinux.org/gf/download/frsrelease/29/2549/Blackfin_PRM.pdf The Blackfin processor is already supported by major releases of gcc, and there are binary and source rpms/tarballs for many architectures at: http://blackfin.uclinux.org/gf/project/toolchain/frs There is complete documentation, including "getting started" guides available at: http://docs.blackfin.uclinux.org/ which provides links to the sources and patches you will need in order to set up a cross-compiling environment for bfin-linux-uclibc This patch, as well as the other patches (toolchain, distribution, uClibc) are actively supported by Analog Devices Inc, at: http://blackfin.uclinux.org/ We have tested this on LTP, and our test plan (including pass/fails) can be found at: http://docs.blackfin.uclinux.org/doku.php?id=testing_the_linux_kernel [m.kozlowski@tuxland.pl: balance parenthesis in blackfin header files] Signed-off-by: Bryan Wu <bryan.wu@analog.com> Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl> Signed-off-by: Aubrey Li <aubrey.li@analog.com> Signed-off-by: Jie Zhang <jie.zhang@analog.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/asm-blackfin/io.h')
-rw-r--r--include/asm-blackfin/io.h207
1 files changed, 207 insertions, 0 deletions
diff --git a/include/asm-blackfin/io.h b/include/asm-blackfin/io.h
new file mode 100644
index 000000000000..7e6995e80d97
--- /dev/null
+++ b/include/asm-blackfin/io.h
@@ -0,0 +1,207 @@
1#ifndef _BFIN_IO_H
2#define _BFIN_IO_H
3
4#ifdef __KERNEL__
5
6#ifndef __ASSEMBLY__
7#include <linux/types.h>
8#endif
9#include <linux/compiler.h>
10
11/*
12 * These are for ISA/PCI shared memory _only_ and should never be used
13 * on any other type of memory, including Zorro memory. They are meant to
14 * access the bus in the bus byte order which is little-endian!.
15 *
16 * readX/writeX() are used to access memory mapped devices. On some
17 * architectures the memory mapped IO stuff needs to be accessed
18 * differently. On the bfin architecture, we just read/write the
19 * memory location directly.
20 */
21#ifndef __ASSEMBLY__
22
23static inline unsigned char readb(void __iomem *addr)
24{
25 unsigned int val;
26 int tmp;
27
28 __asm__ __volatile__ ("cli %1;\n\t"
29 "NOP; NOP; SSYNC;\n\t"
30 "%0 = b [%2] (z);\n\t"
31 "sti %1;\n\t"
32 : "=d"(val), "=d"(tmp): "a"(addr)
33 );
34
35 return (unsigned char) val;
36}
37
38static inline unsigned short readw(void __iomem *addr)
39{
40 unsigned int val;
41 int tmp;
42
43 __asm__ __volatile__ ("cli %1;\n\t"
44 "NOP; NOP; SSYNC;\n\t"
45 "%0 = w [%2] (z);\n\t"
46 "sti %1;\n\t"
47 : "=d"(val), "=d"(tmp): "a"(addr)
48 );
49
50 return (unsigned short) val;
51}
52
53static inline unsigned int readl(void __iomem *addr)
54{
55 unsigned int val;
56 int tmp;
57
58 __asm__ __volatile__ ("cli %1;\n\t"
59 "NOP; NOP; SSYNC;\n\t"
60 "%0 = [%2];\n\t"
61 "sti %1;\n\t"
62 : "=d"(val), "=d"(tmp): "a"(addr)
63 );
64 return val;
65}
66
67#endif /* __ASSEMBLY__ */
68
69#define writeb(b,addr) (void)((*(volatile unsigned char *) (addr)) = (b))
70#define writew(b,addr) (void)((*(volatile unsigned short *) (addr)) = (b))
71#define writel(b,addr) (void)((*(volatile unsigned int *) (addr)) = (b))
72
73#define __raw_readb readb
74#define __raw_readw readw
75#define __raw_readl readl
76#define __raw_writeb writeb
77#define __raw_writew writew
78#define __raw_writel writel
79#define memset_io(a,b,c) memset((void *)(a),(b),(c))
80#define memcpy_fromio(a,b,c) memcpy((a),(void *)(b),(c))
81#define memcpy_toio(a,b,c) memcpy((void *)(a),(b),(c))
82
83#define inb(addr) readb(addr)
84#define inw(addr) readw(addr)
85#define inl(addr) readl(addr)
86#define outb(x,addr) ((void) writeb(x,addr))
87#define outw(x,addr) ((void) writew(x,addr))
88#define outl(x,addr) ((void) writel(x,addr))
89
90#define inb_p(addr) inb(addr)
91#define inw_p(addr) inw(addr)
92#define inl_p(addr) inl(addr)
93#define outb_p(x,addr) outb(x,addr)
94#define outw_p(x,addr) outw(x,addr)
95#define outl_p(x,addr) outl(x,addr)
96
97#define ioread8_rep(a,d,c) insb(a,d,c)
98#define ioread16_rep(a,d,c) insw(a,d,c)
99#define ioread32_rep(a,d,c) insl(a,d,c)
100#define iowrite8_rep(a,s,c) outsb(a,s,c)
101#define iowrite16_rep(a,s,c) outsw(a,s,c)
102#define iowrite32_rep(a,s,c) outsl(a,s,c)
103
104#define ioread8(X) readb(X)
105#define ioread16(X) readw(X)
106#define ioread32(X) readl(X)
107#define iowrite8(val,X) writeb(val,X)
108#define iowrite16(val,X) writew(val,X)
109#define iowrite32(val,X) writel(val,X)
110
111#define IO_SPACE_LIMIT 0xffffffff
112
113/* Values for nocacheflag and cmode */
114#define IOMAP_NOCACHE_SER 1
115
116#ifndef __ASSEMBLY__
117
118extern void outsb(void __iomem *port, const void *addr, unsigned long count);
119extern void outsw(void __iomem *port, const void *addr, unsigned long count);
120extern void outsl(void __iomem *port, const void *addr, unsigned long count);
121
122extern void insb(const void __iomem *port, void *addr, unsigned long count);
123extern void insw(const void __iomem *port, void *addr, unsigned long count);
124extern void insl(const void __iomem *port, void *addr, unsigned long count);
125
126/*
127 * Map some physical address range into the kernel address space.
128 */
129static inline void __iomem *__ioremap(unsigned long physaddr, unsigned long size,
130 int cacheflag)
131{
132 return (void __iomem *)physaddr;
133}
134
135/*
136 * Unmap a ioremap()ed region again
137 */
138static inline void iounmap(void *addr)
139{
140}
141
142/*
143 * __iounmap unmaps nearly everything, so be careful
144 * it doesn't free currently pointer/page tables anymore but it
145 * wans't used anyway and might be added later.
146 */
147static inline void __iounmap(void *addr, unsigned long size)
148{
149}
150
151/*
152 * Set new cache mode for some kernel address space.
153 * The caller must push data for that range itself, if such data may already
154 * be in the cache.
155 */
156static inline void kernel_set_cachemode(void *addr, unsigned long size,
157 int cmode)
158{
159}
160
161static inline void __iomem *ioremap(unsigned long physaddr, unsigned long size)
162{
163 return __ioremap(physaddr, size, IOMAP_NOCACHE_SER);
164}
165static inline void __iomem *ioremap_nocache(unsigned long physaddr,
166 unsigned long size)
167{
168 return __ioremap(physaddr, size, IOMAP_NOCACHE_SER);
169}
170
171extern void blkfin_inv_cache_all(void);
172
173#endif
174
175#define ioport_map(port, nr) ((void __iomem*)(port))
176#define ioport_unmap(addr)
177
178#define dma_cache_inv(_start,_size) do { blkfin_inv_cache_all();} while (0)
179#define dma_cache_wback(_start,_size) do { } while (0)
180#define dma_cache_wback_inv(_start,_size) do { blkfin_inv_cache_all();} while (0)
181
182/* Pages to physical address... */
183#define page_to_phys(page) ((page - mem_map) << PAGE_SHIFT)
184#define page_to_bus(page) ((page - mem_map) << PAGE_SHIFT)
185
186#define mm_ptov(vaddr) ((void *) (vaddr))
187#define mm_vtop(vaddr) ((unsigned long) (vaddr))
188#define phys_to_virt(vaddr) ((void *) (vaddr))
189#define virt_to_phys(vaddr) ((unsigned long) (vaddr))
190
191#define virt_to_bus virt_to_phys
192#define bus_to_virt phys_to_virt
193
194/*
195 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
196 * access
197 */
198#define xlate_dev_mem_ptr(p) __va(p)
199
200/*
201 * Convert a virtual cached pointer to an uncached pointer
202 */
203#define xlate_dev_kmem_ptr(p) p
204
205#endif /* __KERNEL__ */
206
207#endif /* _BFIN_IO_H */