treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / arch / arm / mach-omap1 / include / mach / memory.h
blob1142560e0078f5eb6e0547916d8e18400ba3378c
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * arch/arm/mach-omap1/include/mach/memory.h
4 */
6 #ifndef __ASM_ARCH_MEMORY_H
7 #define __ASM_ARCH_MEMORY_H
9 /* REVISIT: omap1 legacy drivers still rely on this */
10 #include <mach/soc.h>
13 * Bus address is physical address, except for OMAP-1510 Local Bus.
14 * OMAP-1510 bus address is translated into a Local Bus address if the
15 * OMAP bus type is lbus. We do the address translation based on the
16 * device overriding the defaults used in the dma-mapping API.
17 * Note that the is_lbus_device() test is not very efficient on 1510
18 * because of the strncmp().
20 #if defined(CONFIG_ARCH_OMAP15XX) && !defined(__ASSEMBLER__)
23 * OMAP-1510 Local Bus address offset
25 #define OMAP1510_LB_OFFSET UL(0x30000000)
27 #define virt_to_lbus(x) ((x) - PAGE_OFFSET + OMAP1510_LB_OFFSET)
28 #define lbus_to_virt(x) ((x) - OMAP1510_LB_OFFSET + PAGE_OFFSET)
29 #define is_lbus_device(dev) (cpu_is_omap15xx() && dev && (strncmp(dev_name(dev), "ohci", 4) == 0))
31 #define __arch_pfn_to_dma(dev, pfn) \
32 ({ dma_addr_t __dma = __pfn_to_phys(pfn); \
33 if (is_lbus_device(dev)) \
34 __dma = __dma - PHYS_OFFSET + OMAP1510_LB_OFFSET; \
35 __dma; })
37 #define __arch_dma_to_pfn(dev, addr) \
38 ({ dma_addr_t __dma = addr; \
39 if (is_lbus_device(dev)) \
40 __dma += PHYS_OFFSET - OMAP1510_LB_OFFSET; \
41 __phys_to_pfn(__dma); \
44 #define __arch_dma_to_virt(dev, addr) ({ (void *) (is_lbus_device(dev) ? \
45 lbus_to_virt(addr) : \
46 __phys_to_virt(addr)); })
48 #define __arch_virt_to_dma(dev, addr) ({ unsigned long __addr = (unsigned long)(addr); \
49 (dma_addr_t) (is_lbus_device(dev) ? \
50 virt_to_lbus(__addr) : \
51 __virt_to_phys(__addr)); })
53 #endif /* CONFIG_ARCH_OMAP15XX */
55 #endif