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.
7 * Portions Copyright (C) Cisco Systems, Inc.
9 #ifndef __ASM_MACH_POWERTV_IOREMAP_H
10 #define __ASM_MACH_POWERTV_IOREMAP_H
12 #include <linux/types.h>
14 #define LOW_MEM_BOUNDARY_PHYS 0x20000000
15 #define LOW_MEM_BOUNDARY_MASK (~(LOW_MEM_BOUNDARY_PHYS - 1))
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
;
25 #define MEM_GAP_PHYS 0x60000000
27 * TODO: We will use the hard code for conversion between physical and
28 * bus until the bootloader releases their device tree to us.
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))
35 #define phys_to_bus(x) ((x) + phys_to_bus_offset)
36 #define bus_to_phys(x) ((x) - phys_to_bus_offset)
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
45 static inline int asic_is_device_addr(phys_t addr
)
47 return !((phys_t
)addr
& (phys_t
) LOW_MEM_BOUNDARY_MASK
);
51 * Determine whether the address we are given is external RAM mappable
53 * Params: addr Address to check
54 * Returns: Zero if the address is not for external RAM and
56 static inline int asic_is_lowmem_ram_addr(phys_t addr
)
59 * The RAM always starts at the following address in the processor's
60 * physical address space
62 static const phys_t phys_ram_base
= 0x10000000;
65 bus_ram_base
= phys_to_bus_offset
+ phys_ram_base
;
67 return addr
>= bus_ram_base
&&
68 addr
< (bus_ram_base
+ (LOW_MEM_BOUNDARY_PHYS
- phys_ram_base
));
72 * Allow physical addresses to be fixed up to help peripherals located
73 * outside the low 32-bit range -- generic pass-through version.
75 static inline phys_t
fixup_bigphys_addr(phys_t phys_addr
, phys_t size
)
80 static inline void __iomem
*plat_ioremap(phys_t offset
, unsigned long size
,
86 static inline int plat_iounmap(const volatile void __iomem
*addr
)
90 #endif /* __ASM_MACH_POWERTV_IOREMAP_H */