]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - arch/arm/mach-iop13xx/include/mach/memory.h
[ARM] Add -march=all to assembly file build in arch/arm/boot/compressed
[linux-2.6-omap-h63xx.git] / arch / arm / mach-iop13xx / include / mach / memory.h
1 #ifndef __ASM_ARCH_MEMORY_H
2 #define __ASM_ARCH_MEMORY_H
3
4 #include <mach/hardware.h>
5
6 /*
7  * Physical DRAM offset.
8  */
9 #define PHYS_OFFSET     UL(0x00000000)
10
11 #ifndef __ASSEMBLY__
12
13 #if defined(CONFIG_ARCH_IOP13XX)
14 #define IOP13XX_PMMR_V_START (IOP13XX_PMMR_VIRT_MEM_BASE)
15 #define IOP13XX_PMMR_V_END   (IOP13XX_PMMR_VIRT_MEM_BASE + IOP13XX_PMMR_SIZE)
16 #define IOP13XX_PMMR_P_START (IOP13XX_PMMR_PHYS_MEM_BASE)
17 #define IOP13XX_PMMR_P_END   (IOP13XX_PMMR_PHYS_MEM_BASE + IOP13XX_PMMR_SIZE)
18
19 /*
20  * Virtual view <-> PCI DMA view memory address translations
21  * virt_to_bus: Used to translate the virtual address to an
22  *              address suitable to be passed to set_dma_addr
23  * bus_to_virt: Used to convert an address for DMA operations
24  *              to an address that the kernel can use.
25  */
26
27 /* RAM has 1:1 mapping on the PCIe/x Busses */
28 #define __virt_to_bus(x)        (__virt_to_phys(x))
29 #define __bus_to_virt(x)    (__phys_to_virt(x))
30
31 #define virt_to_lbus(x)                                            \
32 (( ((void*)(x) >= (void*)IOP13XX_PMMR_V_START) &&                  \
33 ((void*)(x) < (void*)IOP13XX_PMMR_V_END) ) ?                       \
34 ((x) - IOP13XX_PMMR_VIRT_MEM_BASE + IOP13XX_PMMR_PHYS_MEM_BASE) : \
35 ((x) - PAGE_OFFSET + PHYS_OFFSET))
36
37 #define lbus_to_virt(x)                                            \
38 (( ((x) >= IOP13XX_PMMR_P_START) && ((x) < IOP13XX_PMMR_P_END) ) ? \
39 ((x) - IOP13XX_PMMR_PHYS_MEM_BASE + IOP13XX_PMMR_VIRT_MEM_BASE ) : \
40 ((x) - PHYS_OFFSET + PAGE_OFFSET))
41
42 /* Device is an lbus device if it is on the platform bus of the IOP13XX */
43 #define is_lbus_device(dev) (dev &&\
44                              (strncmp(dev->bus->name, "platform", 8) == 0))
45
46 #define __arch_page_to_dma(dev, page)                                   \
47 ({is_lbus_device(dev) ? (dma_addr_t)virt_to_lbus(page_address(page)) : \
48 (dma_addr_t)__virt_to_bus(page_address(page));})
49
50 #define __arch_dma_to_virt(dev, addr) \
51 ({is_lbus_device(dev) ? lbus_to_virt(addr) : __bus_to_virt(addr);})
52
53 #define __arch_virt_to_dma(dev, addr) \
54 ({is_lbus_device(dev) ? virt_to_lbus(addr) : __virt_to_bus(addr);})
55
56 #endif /* CONFIG_ARCH_IOP13XX */
57 #endif /* !ASSEMBLY */
58
59 #define PFN_TO_NID(addr)        (0)
60
61 #endif