diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-07-24 12:55:18 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-07-24 12:55:18 -0400 |
commit | ff0c4ad2c3a75ccfe6adca916e50804eb45bb2d9 (patch) | |
tree | 574f2d38793f7a08af73c40a96d6dc76af9c6f46 /include | |
parent | fcda12e7f6d58d61997681a9d41779e3fd2ffc94 (diff) | |
parent | 19f9d392365113f74286b1721c7c032c12cf5abd (diff) |
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 @@ | |||
1 | #ifndef __ASM_GENERIC_DELAY_H | 1 | #ifndef __ASM_GENERIC_DELAY_H |
2 | #define __ASM_GENERIC_DELAY_H | 2 | #define __ASM_GENERIC_DELAY_H |
3 | 3 | ||
4 | /* Undefined functions to get compile-time errors */ | ||
5 | extern void __bad_udelay(void); | ||
6 | extern void __bad_ndelay(void); | ||
7 | |||
4 | extern void __udelay(unsigned long usecs); | 8 | extern void __udelay(unsigned long usecs); |
9 | extern void __ndelay(unsigned long nsecs); | ||
10 | extern void __const_udelay(unsigned long xloops); | ||
5 | extern void __delay(unsigned long loops); | 11 | extern void __delay(unsigned long loops); |
6 | 12 | ||
7 | #define udelay(n) __udelay(n) | 13 | /* |
14 | * The weird n/20000 thing suppresses a "comparison is always false due to | ||
15 | * limited range of data type" warning with non-const 8-bit arguments. | ||
16 | */ | ||
17 | |||
18 | /* 0x10c7 is 2**32 / 1000000 (rounded up) */ | ||
19 | #define udelay(n) \ | ||
20 | ({ \ | ||
21 | if (__builtin_constant_p(n)) { \ | ||
22 | if ((n) / 20000 >= 1) \ | ||
23 | __bad_udelay(); \ | ||
24 | else \ | ||
25 | __const_udelay((n) * 0x10c7ul); \ | ||
26 | } else { \ | ||
27 | __udelay(n); \ | ||
28 | } \ | ||
29 | }) | ||
30 | |||
31 | /* 0x5 is 2**32 / 1000000000 (rounded up) */ | ||
32 | #define ndelay(n) \ | ||
33 | ({ \ | ||
34 | if (__builtin_constant_p(n)) { \ | ||
35 | if ((n) / 20000 >= 1) \ | ||
36 | __bad_ndelay(); \ | ||
37 | else \ | ||
38 | __const_udelay((n) * 5ul); \ | ||
39 | } else { \ | ||
40 | __ndelay(n); \ | ||
41 | } \ | ||
42 | }) | ||
8 | 43 | ||
9 | #endif /* __ASM_GENERIC_DELAY_H */ | 44 | #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) | |||
307 | 307 | ||
308 | /* | 308 | /* |
309 | * Change "struct page" to physical address. | 309 | * Change "struct page" to physical address. |
310 | * | ||
311 | * This implementation is for the no-MMU case only... if you have an MMU | ||
312 | * you'll need to provide your own definitions. | ||
310 | */ | 313 | */ |
314 | #ifndef CONFIG_MMU | ||
311 | static inline void __iomem *ioremap(phys_addr_t offset, unsigned long size) | 315 | static inline void __iomem *ioremap(phys_addr_t offset, unsigned long size) |
312 | { | 316 | { |
313 | return (void __iomem*) (unsigned long)offset; | 317 | return (void __iomem*) (unsigned long)offset; |
@@ -326,7 +330,9 @@ static inline void __iomem *ioremap(phys_addr_t offset, unsigned long size) | |||
326 | static inline void iounmap(void *addr) | 330 | static inline void iounmap(void *addr) |
327 | { | 331 | { |
328 | } | 332 | } |
333 | #endif /* CONFIG_MMU */ | ||
329 | 334 | ||
335 | #ifdef CONFIG_HAS_IOPORT | ||
330 | #ifndef CONFIG_GENERIC_IOMAP | 336 | #ifndef CONFIG_GENERIC_IOMAP |
331 | static inline void __iomem *ioport_map(unsigned long port, unsigned int nr) | 337 | static inline void __iomem *ioport_map(unsigned long port, unsigned int nr) |
332 | { | 338 | { |
@@ -340,9 +346,10 @@ static inline void ioport_unmap(void __iomem *p) | |||
340 | extern void __iomem *ioport_map(unsigned long port, unsigned int nr); | 346 | extern void __iomem *ioport_map(unsigned long port, unsigned int nr); |
341 | extern void ioport_unmap(void __iomem *p); | 347 | extern void ioport_unmap(void __iomem *p); |
342 | #endif /* CONFIG_GENERIC_IOMAP */ | 348 | #endif /* CONFIG_GENERIC_IOMAP */ |
349 | #endif /* CONFIG_HAS_IOPORT */ | ||
343 | 350 | ||
344 | #define xlate_dev_kmem_ptr(p) p | 351 | #define xlate_dev_kmem_ptr(p) p |
345 | #define xlate_dev_mem_ptr(p) ((void *) (p)) | 352 | #define xlate_dev_mem_ptr(p) __va(p) |
346 | 353 | ||
347 | #ifndef virt_to_bus | 354 | #ifndef virt_to_bus |
348 | static inline unsigned long virt_to_bus(volatile void *address) | 355 | 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 | |||
56 | extern void iowrite16_rep(void __iomem *port, const void *buf, unsigned long count); | 56 | extern void iowrite16_rep(void __iomem *port, const void *buf, unsigned long count); |
57 | extern void iowrite32_rep(void __iomem *port, const void *buf, unsigned long count); | 57 | extern void iowrite32_rep(void __iomem *port, const void *buf, unsigned long count); |
58 | 58 | ||
59 | #ifdef CONFIG_HAS_IOPORT | ||
59 | /* Create a virtual mapping cookie for an IO port range */ | 60 | /* Create a virtual mapping cookie for an IO port range */ |
60 | extern void __iomem *ioport_map(unsigned long port, unsigned int nr); | 61 | extern void __iomem *ioport_map(unsigned long port, unsigned int nr); |
61 | extern void ioport_unmap(void __iomem *); | 62 | extern void ioport_unmap(void __iomem *); |
63 | #endif | ||
62 | 64 | ||
63 | #ifndef ARCH_HAS_IOREMAP_WC | 65 | #ifndef ARCH_HAS_IOREMAP_WC |
64 | #define ioremap_wc ioremap_nocache | 66 | #define ioremap_wc ioremap_nocache |
65 | #endif | 67 | #endif |
66 | 68 | ||
69 | #ifdef CONFIG_PCI | ||
67 | /* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ | 70 | /* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ |
68 | struct pci_dev; | 71 | struct pci_dev; |
69 | extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max); | 72 | extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max); |
70 | extern void pci_iounmap(struct pci_dev *dev, void __iomem *); | 73 | extern void pci_iounmap(struct pci_dev *dev, void __iomem *); |
74 | #endif | ||
71 | 75 | ||
72 | #endif | 76 | #endif |