blob: 8546703a0b3b9f697e11cd2e66b354adff6af3a1 [file] [log] [blame]
Russell Kinga09e64f2008-08-05 16:14:15 +01001/* arch/arm/mach-msm/include/mach/memory.h
2 *
3 * Copyright (C) 2007 Google, Inc.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004 * Copyright (c) 2009-2011, Code Aurora Forum. All rights reserved.
Russell Kinga09e64f2008-08-05 16:14:15 +01005 *
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 */
Russell Kinga09e64f2008-08-05 16:14:15 +010016#ifndef __ASM_ARCH_MEMORY_H
17#define __ASM_ARCH_MEMORY_H
Larry Bassela4414b12011-08-04 11:11:02 -070018#include <linux/types.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010019
20/* physical offset of RAM */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070021#define PLAT_PHYS_OFFSET UL(CONFIG_PHYS_OFFSET)
22
23#define MAX_PHYSMEM_BITS 32
24#define SECTION_SIZE_BITS 28
25
26/* Certain configurations of MSM7x30 have multiple memory banks.
27* One or more of these banks can contain holes in the memory map as well.
28* These macros define appropriate conversion routines between the physical
29* and virtual address domains for supporting these configurations using
30* SPARSEMEM and a 3G/1G VM split.
31*/
32
33#if defined(CONFIG_ARCH_MSM7X30)
34
35#define EBI0_PHYS_OFFSET PHYS_OFFSET
36#define EBI0_PAGE_OFFSET PAGE_OFFSET
37#define EBI0_SIZE 0x10000000
38
39#define EBI1_PHYS_OFFSET 0x40000000
40#define EBI1_PAGE_OFFSET (EBI0_PAGE_OFFSET + EBI0_SIZE)
41
42#if (defined(CONFIG_SPARSEMEM) && defined(CONFIG_VMSPLIT_3G))
43
44#define __phys_to_virt(phys) \
45 ((phys) >= EBI1_PHYS_OFFSET ? \
46 (phys) - EBI1_PHYS_OFFSET + EBI1_PAGE_OFFSET : \
47 (phys) - EBI0_PHYS_OFFSET + EBI0_PAGE_OFFSET)
48
49#define __virt_to_phys(virt) \
50 ((virt) >= EBI1_PAGE_OFFSET ? \
51 (virt) - EBI1_PAGE_OFFSET + EBI1_PHYS_OFFSET : \
52 (virt) - EBI0_PAGE_OFFSET + EBI0_PHYS_OFFSET)
53
Daniel Walker81d658a2010-05-06 14:16:04 -070054#endif
Russell Kinga09e64f2008-08-05 16:14:15 +010055
Russell Kinga09e64f2008-08-05 16:14:15 +010056#endif
57
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070058#define HAS_ARCH_IO_REMAP_PFN_RANGE
59
60#ifndef __ASSEMBLY__
61void *alloc_bootmem_aligned(unsigned long size, unsigned long alignment);
62void *allocate_contiguous_ebi(unsigned long, unsigned long, int);
63unsigned long allocate_contiguous_ebi_nomap(unsigned long, unsigned long);
64void clean_and_invalidate_caches(unsigned long, unsigned long, unsigned long);
65void clean_caches(unsigned long, unsigned long, unsigned long);
66void invalidate_caches(unsigned long, unsigned long, unsigned long);
Larry Bassela4414b12011-08-04 11:11:02 -070067int platform_physical_remove_pages(u64, u64);
68int platform_physical_active_pages(u64, u64);
69int platform_physical_low_power_pages(u64, u64);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070070
Larry Bassela4414b12011-08-04 11:11:02 -070071extern int (*change_memory_power)(u64, u64, int);
Larry Bassela7eadea2011-07-14 10:46:00 -070072
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070073#if defined(CONFIG_ARCH_MSM_ARM11) || defined(CONFIG_ARCH_MSM_CORTEX_A5)
74void write_to_strongly_ordered_memory(void);
75void map_page_strongly_ordered(void);
76#endif
77
78#ifdef CONFIG_CACHE_L2X0
79extern void l2x0_cache_sync(void);
80#define finish_arch_switch(prev) do { l2x0_cache_sync(); } while (0)
81#endif
82
Vikram Mulukutlac39c6092011-07-29 18:36:35 -070083#if defined(CONFIG_ARCH_MSM8X60) || defined(CONFIG_ARCH_MSM8960)
84extern void store_ttbr0(void);
85#define finish_arch_switch(prev) do { store_ttbr0(); } while (0)
86#endif
87
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070088#endif
89
90#if defined CONFIG_ARCH_MSM_SCORPION || defined CONFIG_ARCH_MSM_KRAIT
91#define arch_has_speculative_dfetch() 1
92#endif
93
94#endif
95
96/* these correspond to values known by the modem */
97#define MEMORY_DEEP_POWERDOWN 0
98#define MEMORY_SELF_REFRESH 1
99#define MEMORY_ACTIVE 2
100
101#define NPA_MEMORY_NODE_NAME "/mem/apps/ddr_dpd"
102
103#ifndef CONFIG_ARCH_MSM7X27
104#define CONSISTENT_DMA_SIZE (SZ_1M * 14)
105#endif