diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-07-24 09:55:18 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-07-24 09:55:18 -0700 |
commit | ff0c4ad2c3a75ccfe6adca916e50804eb45bb2d9 (patch) | |
tree | 574f2d38793f7a08af73c40a96d6dc76af9c6f46 /include | |
parent | fcda12e7f6d58d61997681a9d41779e3fd2ffc94 (diff) | |
parent | 19f9d392365113f74286b1721c7c032c12cf5abd (diff) | |
download | linux-stable-ff0c4ad2c3a75ccfe6adca916e50804eb45bb2d9.tar.gz linux-stable-ff0c4ad2c3a75ccfe6adca916e50804eb45bb2d9.tar.bz2 linux-stable-ff0c4ad2c3a75ccfe6adca916e50804eb45bb2d9.zip |
Merge branch 'for-upstream' of git://openrisc.net/jonas/linux
* 'for-upstream' of git://openrisc.net/jonas/linux: (24 commits)
OpenRISC: Add MAINTAINERS entry
OpenRISC: Miscellaneous
OpenRISC: Library routines
OpenRISC: Headers
OpenRISC: Traps
OpenRISC: Module support
OpenRISC: GPIO
OpenRISC: Scheduling/Process management
OpenRISC: Idle/Power management
OpenRISC: System calls
OpenRISC: IRQ
OpenRISC: Timekeeping
OpenRISC: DMA
OpenRISC: PTrace
OpenRISC: Build infrastructure
OpenRISC: Signal handling
OpenRISC: Memory management
OpenRISC: Device tree
OpenRISC: Boot code
iomap: make IOPORT/PCI mapping functions conditional
...
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-generic/delay.h | 37 | ||||
-rw-r--r-- | include/asm-generic/io.h | 9 | ||||
-rw-r--r-- | include/asm-generic/iomap.h | 4 |
3 files changed, 48 insertions, 2 deletions
diff --git a/include/asm-generic/delay.h b/include/asm-generic/delay.h index 4586fec75ddb..0f79054ce7cd 100644 --- a/include/asm-generic/delay.h +++ b/include/asm-generic/delay.h @@ -1,9 +1,44 @@ #ifndef __ASM_GENERIC_DELAY_H #define __ASM_GENERIC_DELAY_H +/* Undefined functions to get compile-time errors */ +extern void __bad_udelay(void); +extern void __bad_ndelay(void); + extern void __udelay(unsigned long usecs); +extern void __ndelay(unsigned long nsecs); +extern void __const_udelay(unsigned long xloops); extern void __delay(unsigned long loops); -#define udelay(n) __udelay(n) +/* + * The weird n/20000 thing suppresses a "comparison is always false due to + * limited range of data type" warning with non-const 8-bit arguments. + */ + +/* 0x10c7 is 2**32 / 1000000 (rounded up) */ +#define udelay(n) \ + ({ \ + if (__builtin_constant_p(n)) { \ + if ((n) / 20000 >= 1) \ + __bad_udelay(); \ + else \ + __const_udelay((n) * 0x10c7ul); \ + } else { \ + __udelay(n); \ + } \ + }) + +/* 0x5 is 2**32 / 1000000000 (rounded up) */ +#define ndelay(n) \ + ({ \ + if (__builtin_constant_p(n)) { \ + if ((n) / 20000 >= 1) \ + __bad_ndelay(); \ + else \ + __const_udelay((n) * 5ul); \ + } else { \ + __ndelay(n); \ + } \ + }) #endif /* __ASM_GENERIC_DELAY_H */ diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h index e0ffa3ddb02a..912088773a69 100644 --- a/include/asm-generic/io.h +++ b/include/asm-generic/io.h @@ -307,7 +307,11 @@ static inline void *phys_to_virt(unsigned long address) /* * Change "struct page" to physical address. + * + * This implementation is for the no-MMU case only... if you have an MMU + * you'll need to provide your own definitions. */ +#ifndef CONFIG_MMU static inline void __iomem *ioremap(phys_addr_t offset, unsigned long size) { return (void __iomem*) (unsigned long)offset; @@ -326,7 +330,9 @@ static inline void __iomem *ioremap(phys_addr_t offset, unsigned long size) static inline void iounmap(void *addr) { } +#endif /* CONFIG_MMU */ +#ifdef CONFIG_HAS_IOPORT #ifndef CONFIG_GENERIC_IOMAP static inline void __iomem *ioport_map(unsigned long port, unsigned int nr) { @@ -340,9 +346,10 @@ static inline void ioport_unmap(void __iomem *p) extern void __iomem *ioport_map(unsigned long port, unsigned int nr); extern void ioport_unmap(void __iomem *p); #endif /* CONFIG_GENERIC_IOMAP */ +#endif /* CONFIG_HAS_IOPORT */ #define xlate_dev_kmem_ptr(p) p -#define xlate_dev_mem_ptr(p) ((void *) (p)) +#define xlate_dev_mem_ptr(p) __va(p) #ifndef virt_to_bus static inline unsigned long virt_to_bus(volatile void *address) diff --git a/include/asm-generic/iomap.h b/include/asm-generic/iomap.h index 76b0cc5637f8..c74ef2c6e633 100644 --- a/include/asm-generic/iomap.h +++ b/include/asm-generic/iomap.h @@ -56,17 +56,21 @@ extern void iowrite8_rep(void __iomem *port, const void *buf, unsigned long coun extern void iowrite16_rep(void __iomem *port, const void *buf, unsigned long count); extern void iowrite32_rep(void __iomem *port, const void *buf, unsigned long count); +#ifdef CONFIG_HAS_IOPORT /* Create a virtual mapping cookie for an IO port range */ extern void __iomem *ioport_map(unsigned long port, unsigned int nr); extern void ioport_unmap(void __iomem *); +#endif #ifndef ARCH_HAS_IOREMAP_WC #define ioremap_wc ioremap_nocache #endif +#ifdef CONFIG_PCI /* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ struct pci_dev; extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max); extern void pci_iounmap(struct pci_dev *dev, void __iomem *); +#endif #endif |