|
@@ -82,6 +82,11 @@ extern void __iomem *__arm_ioremap_pfn(unsigned long, unsigned long, size_t, uns
|
|
|
extern void __iomem *__arm_ioremap(unsigned long, size_t, unsigned int);
|
|
|
extern void __iomem *__arm_ioremap_exec(unsigned long, size_t, bool cached);
|
|
|
extern void __iounmap(volatile void __iomem *addr);
|
|
|
+extern void __arm_iounmap(volatile void __iomem *addr);
|
|
|
+
|
|
|
+extern void __iomem * (*arch_ioremap_caller)(unsigned long, size_t,
|
|
|
+ unsigned int, void *);
|
|
|
+extern void (*arch_iounmap)(volatile void __iomem *);
|
|
|
|
|
|
/*
|
|
|
* Bad read/write accesses...
|
|
@@ -96,6 +101,8 @@ static inline void __iomem *__typesafe_io(unsigned long addr)
|
|
|
return (void __iomem *)addr;
|
|
|
}
|
|
|
|
|
|
+#define IOMEM(x) ((void __force __iomem *)(x))
|
|
|
+
|
|
|
/* IO barriers */
|
|
|
#ifdef CONFIG_ARM_DMA_MEM_BUFFERABLE
|
|
|
#include <asm/barrier.h>
|
|
@@ -109,7 +116,11 @@ static inline void __iomem *__typesafe_io(unsigned long addr)
|
|
|
/*
|
|
|
* Now, pick up the machine-defined IO definitions
|
|
|
*/
|
|
|
+#ifdef CONFIG_NEED_MACH_IO_H
|
|
|
#include <mach/io.h>
|
|
|
+#else
|
|
|
+#define __io(a) ({ (void)(a); __typesafe_io(0); })
|
|
|
+#endif
|
|
|
|
|
|
/*
|
|
|
* This is the limit of PC card/PCI/ISA IO space, which is by default
|
|
@@ -211,18 +222,18 @@ extern void _memset_io(volatile void __iomem *, int, size_t);
|
|
|
* Again, this are defined to perform little endian accesses. See the
|
|
|
* IO port primitives for more information.
|
|
|
*/
|
|
|
-#ifdef __mem_pci
|
|
|
-#define readb_relaxed(c) ({ u8 __r = __raw_readb(__mem_pci(c)); __r; })
|
|
|
+#ifndef readl
|
|
|
+#define readb_relaxed(c) ({ u8 __r = __raw_readb(c); __r; })
|
|
|
#define readw_relaxed(c) ({ u16 __r = le16_to_cpu((__force __le16) \
|
|
|
- __raw_readw(__mem_pci(c))); __r; })
|
|
|
+ __raw_readw(c)); __r; })
|
|
|
#define readl_relaxed(c) ({ u32 __r = le32_to_cpu((__force __le32) \
|
|
|
- __raw_readl(__mem_pci(c))); __r; })
|
|
|
+ __raw_readl(c)); __r; })
|
|
|
|
|
|
-#define writeb_relaxed(v,c) ((void)__raw_writeb(v,__mem_pci(c)))
|
|
|
+#define writeb_relaxed(v,c) ((void)__raw_writeb(v,c))
|
|
|
#define writew_relaxed(v,c) ((void)__raw_writew((__force u16) \
|
|
|
- cpu_to_le16(v),__mem_pci(c)))
|
|
|
+ cpu_to_le16(v),c))
|
|
|
#define writel_relaxed(v,c) ((void)__raw_writel((__force u32) \
|
|
|
- cpu_to_le32(v),__mem_pci(c)))
|
|
|
+ cpu_to_le32(v),c))
|
|
|
|
|
|
#define readb(c) ({ u8 __v = readb_relaxed(c); __iormb(); __v; })
|
|
|
#define readw(c) ({ u16 __v = readw_relaxed(c); __iormb(); __v; })
|
|
@@ -232,30 +243,19 @@ extern void _memset_io(volatile void __iomem *, int, size_t);
|
|
|
#define writew(v,c) ({ __iowmb(); writew_relaxed(v,c); })
|
|
|
#define writel(v,c) ({ __iowmb(); writel_relaxed(v,c); })
|
|
|
|
|
|
-#define readsb(p,d,l) __raw_readsb(__mem_pci(p),d,l)
|
|
|
-#define readsw(p,d,l) __raw_readsw(__mem_pci(p),d,l)
|
|
|
-#define readsl(p,d,l) __raw_readsl(__mem_pci(p),d,l)
|
|
|
-
|
|
|
-#define writesb(p,d,l) __raw_writesb(__mem_pci(p),d,l)
|
|
|
-#define writesw(p,d,l) __raw_writesw(__mem_pci(p),d,l)
|
|
|
-#define writesl(p,d,l) __raw_writesl(__mem_pci(p),d,l)
|
|
|
+#define readsb(p,d,l) __raw_readsb(p,d,l)
|
|
|
+#define readsw(p,d,l) __raw_readsw(p,d,l)
|
|
|
+#define readsl(p,d,l) __raw_readsl(p,d,l)
|
|
|
|
|
|
-#define memset_io(c,v,l) _memset_io(__mem_pci(c),(v),(l))
|
|
|
-#define memcpy_fromio(a,c,l) _memcpy_fromio((a),__mem_pci(c),(l))
|
|
|
-#define memcpy_toio(c,a,l) _memcpy_toio(__mem_pci(c),(a),(l))
|
|
|
+#define writesb(p,d,l) __raw_writesb(p,d,l)
|
|
|
+#define writesw(p,d,l) __raw_writesw(p,d,l)
|
|
|
+#define writesl(p,d,l) __raw_writesl(p,d,l)
|
|
|
|
|
|
-#elif !defined(readb)
|
|
|
+#define memset_io(c,v,l) _memset_io(c,(v),(l))
|
|
|
+#define memcpy_fromio(a,c,l) _memcpy_fromio((a),c,(l))
|
|
|
+#define memcpy_toio(c,a,l) _memcpy_toio(c,(a),(l))
|
|
|
|
|
|
-#define readb(c) (__readwrite_bug("readb"),0)
|
|
|
-#define readw(c) (__readwrite_bug("readw"),0)
|
|
|
-#define readl(c) (__readwrite_bug("readl"),0)
|
|
|
-#define writeb(v,c) __readwrite_bug("writeb")
|
|
|
-#define writew(v,c) __readwrite_bug("writew")
|
|
|
-#define writel(v,c) __readwrite_bug("writel")
|
|
|
-
|
|
|
-#define check_signature(io,sig,len) (0)
|
|
|
-
|
|
|
-#endif /* __mem_pci */
|
|
|
+#endif /* readl */
|
|
|
|
|
|
/*
|
|
|
* ioremap and friends.
|
|
@@ -264,16 +264,11 @@ extern void _memset_io(volatile void __iomem *, int, size_t);
|
|
|
* Documentation/io-mapping.txt.
|
|
|
*
|
|
|
*/
|
|
|
-#ifndef __arch_ioremap
|
|
|
-#define __arch_ioremap __arm_ioremap
|
|
|
-#define __arch_iounmap __iounmap
|
|
|
-#endif
|
|
|
-
|
|
|
-#define ioremap(cookie,size) __arch_ioremap((cookie), (size), MT_DEVICE)
|
|
|
-#define ioremap_nocache(cookie,size) __arch_ioremap((cookie), (size), MT_DEVICE)
|
|
|
-#define ioremap_cached(cookie,size) __arch_ioremap((cookie), (size), MT_DEVICE_CACHED)
|
|
|
-#define ioremap_wc(cookie,size) __arch_ioremap((cookie), (size), MT_DEVICE_WC)
|
|
|
-#define iounmap __arch_iounmap
|
|
|
+#define ioremap(cookie,size) __arm_ioremap((cookie), (size), MT_DEVICE)
|
|
|
+#define ioremap_nocache(cookie,size) __arm_ioremap((cookie), (size), MT_DEVICE)
|
|
|
+#define ioremap_cached(cookie,size) __arm_ioremap((cookie), (size), MT_DEVICE_CACHED)
|
|
|
+#define ioremap_wc(cookie,size) __arm_ioremap((cookie), (size), MT_DEVICE_WC)
|
|
|
+#define iounmap __arm_iounmap
|
|
|
|
|
|
/*
|
|
|
* io{read,write}{8,16,32} macros
|