diff options
author | Paul Mundt <lethal@linux-sh.org> | 2007-11-08 22:58:12 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2008-01-27 23:18:40 -0500 |
commit | da06b8d0545a1bf95b9060bf301d6de3400fafd6 (patch) | |
tree | 275d6a7fb448ee0c34d14ec07b9f9d5a72555487 /include/asm-sh/io.h | |
parent | 3b9e78868d000ca10b740c465df9236b04d29718 (diff) |
sh: Add SH-5 support to io.h.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'include/asm-sh/io.h')
-rw-r--r-- | include/asm-sh/io.h | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/include/asm-sh/io.h b/include/asm-sh/io.h index 6ed34d8eac5f..556aabe844c5 100644 --- a/include/asm-sh/io.h +++ b/include/asm-sh/io.h | |||
@@ -243,12 +243,20 @@ static inline void ctrl_outl(unsigned int b, unsigned long addr) | |||
243 | 243 | ||
244 | static inline void ctrl_delay(void) | 244 | static inline void ctrl_delay(void) |
245 | { | 245 | { |
246 | #ifdef P2SEG | ||
246 | ctrl_inw(P2SEG); | 247 | ctrl_inw(P2SEG); |
248 | #endif | ||
247 | } | 249 | } |
248 | 250 | ||
249 | #define IO_SPACE_LIMIT 0xffffffff | 251 | #define IO_SPACE_LIMIT 0xffffffff |
250 | 252 | ||
251 | #ifdef CONFIG_MMU | 253 | #if !defined(CONFIG_MMU) |
254 | #define virt_to_phys(address) ((unsigned long)(address)) | ||
255 | #define phys_to_virt(address) ((void *)(address)) | ||
256 | #elif defined(CONFIG_SUPERH64) | ||
257 | #define virt_to_phys(address) (__pa(address)) | ||
258 | #define phys_to_virt(address) (__va(address)) | ||
259 | #else | ||
252 | /* | 260 | /* |
253 | * Change virtual addresses to physical addresses and vv. | 261 | * Change virtual addresses to physical addresses and vv. |
254 | * These are trivial on the 1:1 Linux/SuperH mapping | 262 | * These are trivial on the 1:1 Linux/SuperH mapping |
@@ -262,28 +270,24 @@ static inline void *phys_to_virt(unsigned long address) | |||
262 | { | 270 | { |
263 | return (void *)P1SEGADDR(address); | 271 | return (void *)P1SEGADDR(address); |
264 | } | 272 | } |
265 | #else | ||
266 | #define phys_to_virt(address) ((void *)(address)) | ||
267 | #define virt_to_phys(address) ((unsigned long)(address)) | ||
268 | #endif | 273 | #endif |
269 | 274 | ||
270 | /* | 275 | /* |
271 | * readX/writeX() are used to access memory mapped devices. On some | 276 | * On 32-bit SH, we traditionally have the whole physical address space |
272 | * architectures the memory mapped IO stuff needs to be accessed | 277 | * mapped at all times (as MIPS does), so "ioremap()" and "iounmap()" do |
273 | * differently. On the x86 architecture, we just read/write the | 278 | * not need to do anything but place the address in the proper segment. |
274 | * memory location directly. | 279 | * This is true for P1 and P2 addresses, as well as some P3 ones. |
280 | * However, most of the P3 addresses and newer cores using extended | ||
281 | * addressing need to map through page tables, so the ioremap() | ||
282 | * implementation becomes a bit more complicated. | ||
275 | * | 283 | * |
276 | * On SH, we traditionally have the whole physical address space mapped | 284 | * See arch/sh/mm/ioremap.c for additional notes on this. |
277 | * at all times (as MIPS does), so "ioremap()" and "iounmap()" do not | ||
278 | * need to do anything but place the address in the proper segment. This | ||
279 | * is true for P1 and P2 addresses, as well as some P3 ones. However, | ||
280 | * most of the P3 addresses and newer cores using extended addressing | ||
281 | * need to map through page tables, so the ioremap() implementation | ||
282 | * becomes a bit more complicated. See arch/sh/mm/ioremap.c for | ||
283 | * additional notes on this. | ||
284 | * | 285 | * |
285 | * We cheat a bit and always return uncachable areas until we've fixed | 286 | * We cheat a bit and always return uncachable areas until we've fixed |
286 | * the drivers to handle caching properly. | 287 | * the drivers to handle caching properly. |
288 | * | ||
289 | * On the SH-5 the concept of segmentation in the 1:1 PXSEG sense simply | ||
290 | * doesn't exist, so everything must go through page tables. | ||
287 | */ | 291 | */ |
288 | #ifdef CONFIG_MMU | 292 | #ifdef CONFIG_MMU |
289 | void __iomem *__ioremap(unsigned long offset, unsigned long size, | 293 | void __iomem *__ioremap(unsigned long offset, unsigned long size, |
@@ -297,6 +301,7 @@ void __iounmap(void __iomem *addr); | |||
297 | static inline void __iomem * | 301 | static inline void __iomem * |
298 | __ioremap_mode(unsigned long offset, unsigned long size, unsigned long flags) | 302 | __ioremap_mode(unsigned long offset, unsigned long size, unsigned long flags) |
299 | { | 303 | { |
304 | #ifdef CONFIG_SUPERH32 | ||
300 | unsigned long last_addr = offset + size - 1; | 305 | unsigned long last_addr = offset + size - 1; |
301 | 306 | ||
302 | /* | 307 | /* |
@@ -311,6 +316,7 @@ __ioremap_mode(unsigned long offset, unsigned long size, unsigned long flags) | |||
311 | 316 | ||
312 | return (void __iomem *)P2SEGADDR(offset); | 317 | return (void __iomem *)P2SEGADDR(offset); |
313 | } | 318 | } |
319 | #endif | ||
314 | 320 | ||
315 | return __ioremap(offset, size, flags); | 321 | return __ioremap(offset, size, flags); |
316 | } | 322 | } |