diff options
Diffstat (limited to 'arch/arm/plat-omap/sram.c')
| -rw-r--r-- | arch/arm/plat-omap/sram.c | 56 |
1 files changed, 17 insertions, 39 deletions
diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c index 19014b2ff4c6..bc46f33aede3 100644 --- a/arch/arm/plat-omap/sram.c +++ b/arch/arm/plat-omap/sram.c | |||
| @@ -46,14 +46,19 @@ | |||
| 46 | 46 | ||
| 47 | #define ROUND_DOWN(value,boundary) ((value) & (~((boundary)-1))) | 47 | #define ROUND_DOWN(value,boundary) ((value) & (~((boundary)-1))) |
| 48 | 48 | ||
| 49 | static unsigned long omap_sram_start; | ||
| 49 | static unsigned long omap_sram_base; | 50 | static unsigned long omap_sram_base; |
| 50 | static unsigned long omap_sram_size; | 51 | static unsigned long omap_sram_size; |
| 51 | static unsigned long omap_sram_ceil; | 52 | static unsigned long omap_sram_ceil; |
| 52 | 53 | ||
| 53 | unsigned long omap_fb_sram_start; | 54 | extern unsigned long omapfb_reserve_sram(unsigned long sram_pstart, |
| 54 | unsigned long omap_fb_sram_size; | 55 | unsigned long sram_vstart, |
| 56 | unsigned long sram_size, | ||
| 57 | unsigned long pstart_avail, | ||
| 58 | unsigned long size_avail); | ||
| 55 | 59 | ||
| 56 | /* 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 | ||
| 57 | * 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 |
| 58 | * device allows ARM11 but not other initators for full size. This | 63 | * device allows ARM11 but not other initators for full size. This |
| 59 | * functionality seems ok until some nice security API happens. | 64 | * functionality seems ok until some nice security API happens. |
| @@ -77,32 +82,6 @@ static int is_sram_locked(void) | |||
| 77 | return 1; /* assume locked with no PPA or security driver */ | 82 | return 1; /* assume locked with no PPA or security driver */ |
| 78 | } | 83 | } |
| 79 | 84 | ||
| 80 | void get_fb_sram_conf(unsigned long start_avail, unsigned size_avail, | ||
| 81 | unsigned long *start, unsigned long *size) | ||
| 82 | { | ||
| 83 | const struct omap_fbmem_config *fbmem_conf; | ||
| 84 | |||
| 85 | fbmem_conf = omap_get_config(OMAP_TAG_FBMEM, struct omap_fbmem_config); | ||
| 86 | if (fbmem_conf != NULL) { | ||
| 87 | *start = fbmem_conf->fb_sram_start; | ||
| 88 | *size = fbmem_conf->fb_sram_size; | ||
| 89 | } else { | ||
| 90 | *size = 0; | ||
| 91 | *start = 0; | ||
| 92 | } | ||
| 93 | |||
| 94 | if (*size && ( | ||
| 95 | *start < start_avail || | ||
| 96 | *start + *size > start_avail + size_avail)) { | ||
| 97 | printk(KERN_ERR "invalid FB SRAM configuration\n"); | ||
| 98 | *start = start_avail; | ||
| 99 | *size = size_avail; | ||
| 100 | } | ||
| 101 | |||
| 102 | if (*size) | ||
| 103 | pr_info("Reserving %lu bytes SRAM for frame buffer\n", *size); | ||
| 104 | } | ||
| 105 | |||
| 106 | /* | 85 | /* |
| 107 | * The amount of SRAM depends on the core type. | 86 | * The amount of SRAM depends on the core type. |
| 108 | * 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 |
| @@ -111,16 +90,16 @@ void get_fb_sram_conf(unsigned long start_avail, unsigned size_avail, | |||
| 111 | */ | 90 | */ |
| 112 | void __init omap_detect_sram(void) | 91 | void __init omap_detect_sram(void) |
| 113 | { | 92 | { |
| 114 | unsigned long sram_start; | 93 | unsigned long reserved; |
| 115 | 94 | ||
| 116 | if (cpu_is_omap24xx()) { | 95 | if (cpu_is_omap24xx()) { |
| 117 | if (is_sram_locked()) { | 96 | if (is_sram_locked()) { |
| 118 | omap_sram_base = OMAP2_SRAM_PUB_VA; | 97 | omap_sram_base = OMAP2_SRAM_PUB_VA; |
| 119 | sram_start = OMAP2_SRAM_PUB_PA; | 98 | omap_sram_start = OMAP2_SRAM_PUB_PA; |
| 120 | omap_sram_size = 0x800; /* 2K */ | 99 | omap_sram_size = 0x800; /* 2K */ |
| 121 | } else { | 100 | } else { |
| 122 | omap_sram_base = OMAP2_SRAM_VA; | 101 | omap_sram_base = OMAP2_SRAM_VA; |
| 123 | sram_start = OMAP2_SRAM_PA; | 102 | omap_sram_start = OMAP2_SRAM_PA; |
| 124 | if (cpu_is_omap242x()) | 103 | if (cpu_is_omap242x()) |
| 125 | omap_sram_size = 0xa0000; /* 640K */ | 104 | omap_sram_size = 0xa0000; /* 640K */ |
| 126 | else if (cpu_is_omap243x()) | 105 | else if (cpu_is_omap243x()) |
| @@ -128,7 +107,7 @@ void __init omap_detect_sram(void) | |||
| 128 | } | 107 | } |
| 129 | } else { | 108 | } else { |
| 130 | omap_sram_base = OMAP1_SRAM_VA; | 109 | omap_sram_base = OMAP1_SRAM_VA; |
| 131 | sram_start = OMAP1_SRAM_PA; | 110 | omap_sram_start = OMAP1_SRAM_PA; |
| 132 | 111 | ||
| 133 | if (cpu_is_omap730()) | 112 | if (cpu_is_omap730()) |
| 134 | omap_sram_size = 0x32000; /* 200K */ | 113 | omap_sram_size = 0x32000; /* 200K */ |
| @@ -144,12 +123,11 @@ void __init omap_detect_sram(void) | |||
| 144 | omap_sram_size = 0x4000; | 123 | omap_sram_size = 0x4000; |
| 145 | } | 124 | } |
| 146 | } | 125 | } |
| 147 | get_fb_sram_conf(sram_start + SRAM_BOOTLOADER_SZ, | 126 | reserved = omapfb_reserve_sram(omap_sram_start, omap_sram_base, |
| 148 | omap_sram_size - SRAM_BOOTLOADER_SZ, | 127 | omap_sram_size, |
| 149 | &omap_fb_sram_start, &omap_fb_sram_size); | 128 | omap_sram_start + SRAM_BOOTLOADER_SZ, |
| 150 | if (omap_fb_sram_size) | 129 | omap_sram_size - SRAM_BOOTLOADER_SZ); |
| 151 | omap_sram_size -= sram_start + omap_sram_size - | 130 | omap_sram_size -= reserved; |
| 152 | omap_fb_sram_start; | ||
| 153 | omap_sram_ceil = omap_sram_base + omap_sram_size; | 131 | omap_sram_ceil = omap_sram_base + omap_sram_size; |
| 154 | } | 132 | } |
| 155 | 133 | ||
