diff options
Diffstat (limited to 'arch/mips/include/asm/mach-powertv/ioremap.h')
-rw-r--r-- | arch/mips/include/asm/mach-powertv/ioremap.h | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/arch/mips/include/asm/mach-powertv/ioremap.h b/arch/mips/include/asm/mach-powertv/ioremap.h new file mode 100644 index 000000000000..e6276d5146e8 --- /dev/null +++ b/arch/mips/include/asm/mach-powertv/ioremap.h | |||
@@ -0,0 +1,90 @@ | |||
1 | /* | ||
2 | * This program is free software; you can redistribute it and/or | ||
3 | * modify it under the terms of the GNU General Public License | ||
4 | * as published by the Free Software Foundation; either version | ||
5 | * 2 of the License, or (at your option) any later version. | ||
6 | * | ||
7 | * Portions Copyright (C) Cisco Systems, Inc. | ||
8 | */ | ||
9 | #ifndef __ASM_MACH_POWERTV_IOREMAP_H | ||
10 | #define __ASM_MACH_POWERTV_IOREMAP_H | ||
11 | |||
12 | #include <linux/types.h> | ||
13 | |||
14 | #define LOW_MEM_BOUNDARY_PHYS 0x20000000 | ||
15 | #define LOW_MEM_BOUNDARY_MASK (~(LOW_MEM_BOUNDARY_PHYS - 1)) | ||
16 | |||
17 | /* | ||
18 | * The bus addresses are different than the physical addresses that | ||
19 | * the processor sees by an offset. This offset varies by ASIC | ||
20 | * version. Define a variable to hold the offset and some macros to | ||
21 | * make the conversion simpler. */ | ||
22 | extern unsigned long phys_to_bus_offset; | ||
23 | |||
24 | #ifdef CONFIG_HIGHMEM | ||
25 | #define MEM_GAP_PHYS 0x60000000 | ||
26 | /* | ||
27 | * TODO: We will use the hard code for conversion between physical and | ||
28 | * bus until the bootloader releases their device tree to us. | ||
29 | */ | ||
30 | #define phys_to_bus(x) (((x) < LOW_MEM_BOUNDARY_PHYS) ? \ | ||
31 | ((x) + phys_to_bus_offset) : (x)) | ||
32 | #define bus_to_phys(x) (((x) < MEM_GAP_PHYS_ADDR) ? \ | ||
33 | ((x) - phys_to_bus_offset) : (x)) | ||
34 | #else | ||
35 | #define phys_to_bus(x) ((x) + phys_to_bus_offset) | ||
36 | #define bus_to_phys(x) ((x) - phys_to_bus_offset) | ||
37 | #endif | ||
38 | |||
39 | /* | ||
40 | * Determine whether the address we are given is for an ASIC device | ||
41 | * Params: addr Address to check | ||
42 | * Returns: Zero if the address is not for ASIC devices, non-zero | ||
43 | * if it is. | ||
44 | */ | ||
45 | static inline int asic_is_device_addr(phys_t addr) | ||
46 | { | ||
47 | return !((phys_t)addr & (phys_t) LOW_MEM_BOUNDARY_MASK); | ||
48 | } | ||
49 | |||
50 | /* | ||
51 | * Determine whether the address we are given is external RAM mappable | ||
52 | * into KSEG1. | ||
53 | * Params: addr Address to check | ||
54 | * Returns: Zero if the address is not for external RAM and | ||
55 | */ | ||
56 | static inline int asic_is_lowmem_ram_addr(phys_t addr) | ||
57 | { | ||
58 | /* | ||
59 | * The RAM always starts at the following address in the processor's | ||
60 | * physical address space | ||
61 | */ | ||
62 | static const phys_t phys_ram_base = 0x10000000; | ||
63 | phys_t bus_ram_base; | ||
64 | |||
65 | bus_ram_base = phys_to_bus_offset + phys_ram_base; | ||
66 | |||
67 | return addr >= bus_ram_base && | ||
68 | addr < (bus_ram_base + (LOW_MEM_BOUNDARY_PHYS - phys_ram_base)); | ||
69 | } | ||
70 | |||
71 | /* | ||
72 | * Allow physical addresses to be fixed up to help peripherals located | ||
73 | * outside the low 32-bit range -- generic pass-through version. | ||
74 | */ | ||
75 | static inline phys_t fixup_bigphys_addr(phys_t phys_addr, phys_t size) | ||
76 | { | ||
77 | return phys_addr; | ||
78 | } | ||
79 | |||
80 | static inline void __iomem *plat_ioremap(phys_t offset, unsigned long size, | ||
81 | unsigned long flags) | ||
82 | { | ||
83 | return NULL; | ||
84 | } | ||
85 | |||
86 | static inline int plat_iounmap(const volatile void __iomem *addr) | ||
87 | { | ||
88 | return 0; | ||
89 | } | ||
90 | #endif /* __ASM_MACH_POWERTV_IOREMAP_H */ | ||