punt Blackfin VDSP headers and import sanitized/auto-generated ones
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
diff --git a/include/asm-blackfin/io.h b/include/asm-blackfin/io.h
index 5d42668..2149685 100644
--- a/include/asm-blackfin/io.h
+++ b/include/asm-blackfin/io.h
@@ -27,7 +27,12 @@
#ifdef __KERNEL__
-#include <linux/config.h>
+#include <asm/blackfin.h>
+
+static inline void sync(void)
+{
+ SSYNC();
+}
/* function prototypes for CF support */
extern void cf_outsw(unsigned short *addr, unsigned short *sect_buf, int words);
@@ -35,11 +40,6 @@
extern unsigned char cf_inb(volatile unsigned char *addr);
extern void cf_outb(unsigned char val, volatile unsigned char *addr);
-static inline void sync(void)
-{
- __builtin_bfin_ssync();
-}
-
/*
* Given a physical address and a length, return a virtual address
* that can be used to access the memory range with the caching
@@ -77,43 +77,72 @@
* memory location directly.
*/
+#ifndef __ASSEMBLY__
+
+static inline unsigned char readb(const volatile void *addr)
+{
+ unsigned int val;
+ int tmp;
+
-#define readb(addr) ({ unsigned char __v = (*(volatile unsigned char *) (addr));asm("ssync;"); __v; })
-#define readw(addr) ({ unsigned short __v = (*(volatile unsigned short *) (addr)); asm("ssync;");__v; })
-#define readl(addr) ({ unsigned int __v = (*(volatile unsigned int *) (addr));asm("ssync;"); __v; })
+ __asm__ __volatile__ ("cli %1;\n\t"
+ "NOP; NOP; SSYNC;\n\t"
+ "%0 = b [%2] (z);\n\t"
+ "sti %1;\n\t"
+ : "=d"(val), "=d"(tmp): "a"(addr));
+
+ return (unsigned char) val;
+}
+
+static inline unsigned short readw(const volatile void *addr)
+{
+ unsigned int val;
+ int tmp;
+
+ __asm__ __volatile__ ("cli %1;\n\t"
+ "NOP; NOP; SSYNC;\n\t"
+ "%0 = w [%2] (z);\n\t"
+ "sti %1;\n\t"
+ : "=d"(val), "=d"(tmp): "a"(addr));
+
+ return (unsigned short) val;
+}
+
+static inline unsigned int readl(const volatile void *addr)
+{
+ unsigned int val;
+ int tmp;
+
+ __asm__ __volatile__ ("cli %1;\n\t"
+ "NOP; NOP; SSYNC;\n\t"
+ "%0 = [%2];\n\t"
+ "sti %1;\n\t"
+ : "=d"(val), "=d"(tmp): "a"(addr));
+ return val;
+}
+
#define __raw_readb readb
#define __raw_readw readw
#define __raw_readl readl
+#endif /* __ASSEMBLY__ */
+
-#define writeb(b,addr) {((*(volatile unsigned char *) (addr)) = (b)); asm("ssync;");}
-#define writew(b,addr) {((*(volatile unsigned short *) (addr)) = (b)); asm("ssync;");}
-#define writel(b,addr) {((*(volatile unsigned int *) (addr)) = (b)); asm("ssync;");}
+#define writeb(b, addr) (void)((*(volatile unsigned char *) (addr)) = (b))
+#define writew(b, addr) (void)((*(volatile unsigned short *) (addr)) = (b))
+#define writel(b, addr) (void)((*(volatile unsigned int *) (addr)) = (b))
#define __raw_writeb writeb
#define __raw_writew writew
#define __raw_writel writel
-#define memset_io(a,b,c) memset((void *)(a),(b),(c))
-#define memcpy_fromio(a,b,c) memcpy((a),(void *)(b),(c))
-#define memcpy_toio(a,b,c) memcpy((void *)(a),(b),(c))
+#define memset_io(a, b, c) memset((void *)(a), (b), (c))
+#define memcpy_fromio(a, b, c) memcpy((a), (void *)(b), (c))
+#define memcpy_toio(a, b, c) memcpy((void *)(a), (b), (c))
-#define inb_p(addr) readb((addr) + BF533_PCIIO_BASE)
-#define inb(addr) cf_inb((volatile unsigned char*)(addr))
+#define inb(addr) cf_inb((volatile unsigned char *)(addr))
+#define outb(x, addr) cf_outb((unsigned char)(x), (volatile unsigned char *)(addr))
-#define outb(x,addr) cf_outb((unsigned char)(x), (volatile unsigned char*)(addr))
-#define outb_p(x,addr) outb(x, (addr) + BF533_PCIIO_BASE)
+#define insw(port, addr, count) cf_insw((unsigned short *)addr, (unsigned short *)(port), (count))
-#define inw(addr) readw((addr) + BF533_PCIIO_BASE)
-#define inl(addr) readl((addr) + BF533_PCIIO_BASE)
-
-#define outw(x,addr) writew(x, (addr) + BF533_PCIIO_BASE)
-#define outl(x,addr) writel(x, (addr) + BF533_PCIIO_BASE)
-
-#define insb(port, addr, count) memcpy((void*)addr, (void*)(BF533_PCIIO_BASE + port), count)
-#define insw(port, addr, count) cf_insw((unsigned short*)addr, (unsigned short*)(port), (count))
-#define insl(port, addr, count) memcpy((void*)addr, (void*)(BF533_PCIIO_BASE + port), (4*count))
-
-#define outsb(port,addr,count) memcpy((void*)(BF533_PCIIO_BASE + port), (void*)addr, count)
-#define outsw(port,addr,count) cf_outsw((unsigned short*)(port), (unsigned short*)addr, (count))
-#define outsl(port,addr,count) memcpy((void*)(BF533_PCIIO_BASE + port), (void*)addr, (4*count))
+#define outsw(port, addr, count) cf_outsw((unsigned short *)(port), (unsigned short *)addr, (count))
#define IO_SPACE_LIMIT 0xffff
@@ -149,9 +178,9 @@
extern void iounmap(void *addr);
extern void blkfin_inv_cache_all(void);
-#define dma_cache_inv(_start,_size) do { blkfin_inv_cache_all();} while (0)
-#define dma_cache_wback(_start,_size) do { } while (0)
-#define dma_cache_wback_inv(_start,_size) do { blkfin_inv_cache_all();} while (0)
+#define dma_cache_inv(_start, _size) do { blkfin_inv_cache_all(); } while (0)
+#define dma_cache_wback(_start, _size) do { } while (0)
+#define dma_cache_wback_inv(_start, _size) do { blkfin_inv_cache_all(); } while (0)
#endif
#endif