diff options
Diffstat (limited to 'arch/arm/plat-omap/sram.c')
-rw-r--r-- | arch/arm/plat-omap/sram.c | 63 |
1 files changed, 13 insertions, 50 deletions
diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c index 7e5f8877e051..bc46f33aede3 100644 --- a/arch/arm/plat-omap/sram.c +++ b/arch/arm/plat-omap/sram.c | |||
@@ -51,10 +51,14 @@ static unsigned long omap_sram_base; | |||
51 | static unsigned long omap_sram_size; | 51 | static unsigned long omap_sram_size; |
52 | static unsigned long omap_sram_ceil; | 52 | static unsigned long omap_sram_ceil; |
53 | 53 | ||
54 | int omap_fb_sram_plane = -1; | 54 | extern unsigned long omapfb_reserve_sram(unsigned long sram_pstart, |
55 | int omap_fb_sram_valid; | 55 | unsigned long sram_vstart, |
56 | unsigned long sram_size, | ||
57 | unsigned long pstart_avail, | ||
58 | unsigned long size_avail); | ||
56 | 59 | ||
57 | /* Depending on the target RAMFS firewall setup, the public usable amount of | 60 | /* |
61 | * Depending on the target RAMFS firewall setup, the public usable amount of | ||
58 | * SRAM varies. The default accessable size for all device types is 2k. A GP | 62 | * SRAM varies. The default accessable size for all device types is 2k. A GP |
59 | * device allows ARM11 but not other initators for full size. This | 63 | * device allows ARM11 but not other initators for full size. This |
60 | * functionality seems ok until some nice security API happens. | 64 | * functionality seems ok until some nice security API happens. |
@@ -78,45 +82,6 @@ static int is_sram_locked(void) | |||
78 | return 1; /* assume locked with no PPA or security driver */ | 82 | return 1; /* assume locked with no PPA or security driver */ |
79 | } | 83 | } |
80 | 84 | ||
81 | static int get_fb_sram_conf(unsigned long start_avail, unsigned size_avail, | ||
82 | unsigned long *start, int *plane_idx) | ||
83 | { | ||
84 | const struct omap_fbmem_config *fbmem_conf; | ||
85 | unsigned long size = 0; | ||
86 | int i; | ||
87 | |||
88 | i = 0; | ||
89 | *start = 0; | ||
90 | *plane_idx = -1; | ||
91 | while ((fbmem_conf = omap_get_nr_config(OMAP_TAG_FBMEM, | ||
92 | struct omap_fbmem_config, i)) != NULL) { | ||
93 | u32 paddr, end; | ||
94 | |||
95 | paddr = fbmem_conf->start; | ||
96 | end = fbmem_conf->start + fbmem_conf->size; | ||
97 | if (paddr > omap_sram_start && | ||
98 | paddr < omap_sram_start + omap_sram_size) { | ||
99 | if (*plane_idx != -1 || paddr < start_avail || | ||
100 | paddr == end || | ||
101 | end > start_avail + size_avail) { | ||
102 | printk(KERN_ERR "invalid FB SRAM configuration"); | ||
103 | *start = 0; | ||
104 | return -1; | ||
105 | } | ||
106 | *plane_idx = i; | ||
107 | *start = fbmem_conf->start; | ||
108 | size = fbmem_conf->size; | ||
109 | } | ||
110 | i++; | ||
111 | } | ||
112 | |||
113 | if (*plane_idx >= 0) | ||
114 | pr_info("Reserving %lu bytes SRAM frame buffer " | ||
115 | "for plane %d\n", size, *plane_idx); | ||
116 | |||
117 | return 0; | ||
118 | } | ||
119 | |||
120 | /* | 85 | /* |
121 | * The amount of SRAM depends on the core type. | 86 | * The amount of SRAM depends on the core type. |
122 | * Note that we cannot try to test for SRAM here because writes | 87 | * Note that we cannot try to test for SRAM here because writes |
@@ -125,7 +90,7 @@ static int get_fb_sram_conf(unsigned long start_avail, unsigned size_avail, | |||
125 | */ | 90 | */ |
126 | void __init omap_detect_sram(void) | 91 | void __init omap_detect_sram(void) |
127 | { | 92 | { |
128 | unsigned long fb_sram_start; | 93 | unsigned long reserved; |
129 | 94 | ||
130 | if (cpu_is_omap24xx()) { | 95 | if (cpu_is_omap24xx()) { |
131 | if (is_sram_locked()) { | 96 | if (is_sram_locked()) { |
@@ -158,13 +123,11 @@ void __init omap_detect_sram(void) | |||
158 | omap_sram_size = 0x4000; | 123 | omap_sram_size = 0x4000; |
159 | } | 124 | } |
160 | } | 125 | } |
161 | if (get_fb_sram_conf(omap_sram_start + SRAM_BOOTLOADER_SZ, | 126 | reserved = omapfb_reserve_sram(omap_sram_start, omap_sram_base, |
162 | omap_sram_size - SRAM_BOOTLOADER_SZ, | 127 | omap_sram_size, |
163 | &fb_sram_start, &omap_fb_sram_plane) == 0) | 128 | omap_sram_start + SRAM_BOOTLOADER_SZ, |
164 | omap_fb_sram_valid = 1; | 129 | omap_sram_size - SRAM_BOOTLOADER_SZ); |
165 | if (omap_fb_sram_valid && omap_fb_sram_plane >= 0) | 130 | omap_sram_size -= reserved; |
166 | omap_sram_size -= omap_sram_start + omap_sram_size - | ||
167 | fb_sram_start; | ||
168 | omap_sram_ceil = omap_sram_base + omap_sram_size; | 131 | omap_sram_ceil = omap_sram_base + omap_sram_size; |
169 | } | 132 | } |
170 | 133 | ||