Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef _ASM_CRIS_IO_H |
| 2 | #define _ASM_CRIS_IO_H |
| 3 | |
| 4 | #include <asm/page.h> /* for __va, __pa */ |
| 5 | #include <asm/arch/io.h> |
| 6 | |
| 7 | /* |
| 8 | * Change virtual addresses to physical addresses and vv. |
| 9 | */ |
| 10 | |
| 11 | extern inline unsigned long virt_to_phys(volatile void * address) |
| 12 | { |
| 13 | return __pa(address); |
| 14 | } |
| 15 | |
| 16 | extern inline void * phys_to_virt(unsigned long address) |
| 17 | { |
| 18 | return __va(address); |
| 19 | } |
| 20 | |
| 21 | extern void * __ioremap(unsigned long offset, unsigned long size, unsigned long flags); |
| 22 | |
| 23 | extern inline void * ioremap (unsigned long offset, unsigned long size) |
| 24 | { |
| 25 | return __ioremap(offset, size, 0); |
| 26 | } |
| 27 | |
| 28 | extern void iounmap(void *addr); |
| 29 | |
| 30 | /* |
| 31 | * IO bus memory addresses are also 1:1 with the physical address |
| 32 | */ |
| 33 | #define virt_to_bus virt_to_phys |
| 34 | #define bus_to_virt phys_to_virt |
| 35 | |
| 36 | /* |
| 37 | * readX/writeX() are used to access memory mapped devices. On some |
| 38 | * architectures the memory mapped IO stuff needs to be accessed |
| 39 | * differently. On the CRIS architecture, we just read/write the |
| 40 | * memory location directly. |
| 41 | */ |
| 42 | #define readb(addr) (*(volatile unsigned char *) (addr)) |
| 43 | #define readw(addr) (*(volatile unsigned short *) (addr)) |
| 44 | #define readl(addr) (*(volatile unsigned int *) (addr)) |
| 45 | #define readb_relaxed(addr) readb(addr) |
| 46 | #define readw_relaxed(addr) readw(addr) |
| 47 | #define readl_relaxed(addr) readl(addr) |
| 48 | #define __raw_readb readb |
| 49 | #define __raw_readw readw |
| 50 | #define __raw_readl readl |
| 51 | |
| 52 | #define writeb(b,addr) ((*(volatile unsigned char *) (addr)) = (b)) |
| 53 | #define writew(b,addr) ((*(volatile unsigned short *) (addr)) = (b)) |
| 54 | #define writel(b,addr) ((*(volatile unsigned int *) (addr)) = (b)) |
| 55 | #define __raw_writeb writeb |
| 56 | #define __raw_writew writew |
| 57 | #define __raw_writel writel |
| 58 | |
| 59 | #define mmiowb() |
| 60 | |
| 61 | #define memset_io(a,b,c) memset((void *)(a),(b),(c)) |
| 62 | #define memcpy_fromio(a,b,c) memcpy((a),(void *)(b),(c)) |
| 63 | #define memcpy_toio(a,b,c) memcpy((void *)(a),(b),(c)) |
| 64 | |
| 65 | /* |
| 66 | * Again, CRIS does not require mem IO specific function. |
| 67 | */ |
| 68 | |
| 69 | #define eth_io_copy_and_sum(a,b,c,d) eth_copy_and_sum((a),(void *)(b),(c),(d)) |
| 70 | |
| 71 | /* The following is junk needed for the arch-independent code but which |
| 72 | * we never use in the CRIS port |
| 73 | */ |
| 74 | |
| 75 | #define IO_SPACE_LIMIT 0xffff |
| 76 | #define inb(x) (0) |
| 77 | #define inw(x) (0) |
| 78 | #define inl(x) (0) |
| 79 | #define outb(x,y) |
| 80 | #define outw(x,y) |
| 81 | #define outl(x,y) |
| 82 | #define insb(x,y,z) |
| 83 | #define insw(x,y,z) |
| 84 | #define insl(x,y,z) |
| 85 | #define outsb(x,y,z) |
| 86 | #define outsw(x,y,z) |
| 87 | #define outsl(x,y,z) |
| 88 | |
| 89 | /* |
| 90 | * Convert a physical pointer to a virtual kernel pointer for /dev/mem |
| 91 | * access |
| 92 | */ |
| 93 | #define xlate_dev_mem_ptr(p) __va(p) |
| 94 | |
| 95 | /* |
| 96 | * Convert a virtual cached pointer to an uncached pointer |
| 97 | */ |
| 98 | #define xlate_dev_kmem_ptr(p) p |
| 99 | |
| 100 | #endif |