1 #ifndef __ASM_ARCH_MEMORY_H
2 #define __ASM_ARCH_MEMORY_H
4 #include <mach/hardware.h>
7 * Physical DRAM offset.
9 #define PHYS_OFFSET UL(0x00000000)
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)
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.
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))
31 static inline dma_addr_t __virt_to_lbus(unsigned long x)
33 return x + IOP13XX_PMMR_PHYS_MEM_BASE - IOP13XX_PMMR_VIRT_MEM_BASE;
36 static inline unsigned long __lbus_to_virt(dma_addr_t x)
38 return x + IOP13XX_PMMR_VIRT_MEM_BASE - IOP13XX_PMMR_PHYS_MEM_BASE;
41 #define __is_lbus_dma(a) \
42 ((a) >= IOP13XX_PMMR_P_START && (a) < IOP13XX_PMMR_P_END)
44 #define __is_lbus_virt(a) \
45 ((a) >= IOP13XX_PMMR_V_START && (a) < IOP13XX_PMMR_V_END)
47 /* Device is an lbus device if it is on the platform bus of the IOP13XX */
48 #define is_lbus_device(dev) \
49 (dev && strncmp(dev->bus->name, "platform", 8) == 0)
51 #define __arch_dma_to_virt(dev, addr) \
53 unsigned long __virt; \
54 dma_addr_t __dma = addr; \
55 if (is_lbus_device(dev) && __is_lbus_dma(__dma)) \
56 __virt = __lbus_to_virt(__dma); \
58 __virt = __bus_to_virt(__dma); \
62 #define __arch_virt_to_dma(dev, addr) \
64 unsigned long __virt = (unsigned long)addr; \
66 if (is_lbus_device(dev) && __is_lbus_virt(__virt)) \
67 __dma = __virt_to_lbus(__virt); \
69 __dma = __virt_to_bus(__virt); \
73 #define __arch_page_to_dma(dev, page) \
74 __arch_virt_to_dma(dev, page_address(page))
76 #endif /* CONFIG_ARCH_IOP13XX */
77 #endif /* !ASSEMBLY */
79 #define PFN_TO_NID(addr) (0)