diff options
Diffstat (limited to 'meta/recipes-kernel/linux/linux-omap-2.6.29/dss2/0034-DSS2-VRAM-improve-omap_vram_add_region.patch')
-rw-r--r-- | meta/recipes-kernel/linux/linux-omap-2.6.29/dss2/0034-DSS2-VRAM-improve-omap_vram_add_region.patch | 135 |
1 files changed, 135 insertions, 0 deletions
diff --git a/meta/recipes-kernel/linux/linux-omap-2.6.29/dss2/0034-DSS2-VRAM-improve-omap_vram_add_region.patch b/meta/recipes-kernel/linux/linux-omap-2.6.29/dss2/0034-DSS2-VRAM-improve-omap_vram_add_region.patch new file mode 100644 index 0000000000..fdfc25fb47 --- /dev/null +++ b/meta/recipes-kernel/linux/linux-omap-2.6.29/dss2/0034-DSS2-VRAM-improve-omap_vram_add_region.patch | |||
@@ -0,0 +1,135 @@ | |||
1 | From 946eb774e95cdc2f2fa5cdc24aa69229f82814b8 Mon Sep 17 00:00:00 2001 | ||
2 | From: Tomi Valkeinen <tomi.valkeinen@nokia.com> | ||
3 | Date: Thu, 16 Apr 2009 17:56:00 +0300 | ||
4 | Subject: [PATCH] DSS2: VRAM: improve omap_vram_add_region() | ||
5 | |||
6 | Combine postponed and non-posponed versions of omap_vram_add_region. | ||
7 | Make the func non-static, so it can be called from board files. | ||
8 | --- | ||
9 | arch/arm/plat-omap/include/mach/vram.h | 1 + | ||
10 | arch/arm/plat-omap/vram.c | 54 +++++++++++++------------------ | ||
11 | 2 files changed, 24 insertions(+), 31 deletions(-) | ||
12 | |||
13 | diff --git a/arch/arm/plat-omap/include/mach/vram.h b/arch/arm/plat-omap/include/mach/vram.h | ||
14 | index f176562..8639e08 100644 | ||
15 | --- a/arch/arm/plat-omap/include/mach/vram.h | ||
16 | +++ b/arch/arm/plat-omap/include/mach/vram.h | ||
17 | @@ -24,6 +24,7 @@ | ||
18 | |||
19 | #include <asm/types.h> | ||
20 | |||
21 | +extern int omap_vram_add_region(unsigned long paddr, size_t size); | ||
22 | extern int omap_vram_free(unsigned long paddr, size_t size); | ||
23 | extern int omap_vram_alloc(int mtype, size_t size, unsigned long *paddr); | ||
24 | extern int omap_vram_reserve(unsigned long paddr, size_t size); | ||
25 | diff --git a/arch/arm/plat-omap/vram.c b/arch/arm/plat-omap/vram.c | ||
26 | index 520f260..8e9fe77 100644 | ||
27 | --- a/arch/arm/plat-omap/vram.c | ||
28 | +++ b/arch/arm/plat-omap/vram.c | ||
29 | @@ -60,6 +60,7 @@ | ||
30 | * time when we cannot yet allocate the region list */ | ||
31 | #define MAX_POSTPONED_REGIONS 10 | ||
32 | |||
33 | +static bool vram_initialized; | ||
34 | static int postponed_cnt __initdata; | ||
35 | static struct { | ||
36 | unsigned long paddr; | ||
37 | @@ -145,39 +146,32 @@ static void omap_vram_free_allocation(struct vram_alloc *va) | ||
38 | kfree(va); | ||
39 | } | ||
40 | |||
41 | -static __init int omap_vram_add_region_postponed(unsigned long paddr, | ||
42 | - size_t size) | ||
43 | -{ | ||
44 | - if (postponed_cnt == MAX_POSTPONED_REGIONS) | ||
45 | - return -ENOMEM; | ||
46 | - | ||
47 | - postponed_regions[postponed_cnt].paddr = paddr; | ||
48 | - postponed_regions[postponed_cnt].size = size; | ||
49 | - | ||
50 | - ++postponed_cnt; | ||
51 | - | ||
52 | - return 0; | ||
53 | -} | ||
54 | - | ||
55 | -/* add/remove_region can be exported if there's need to add/remove regions | ||
56 | - * runtime */ | ||
57 | -static int omap_vram_add_region(unsigned long paddr, size_t size) | ||
58 | +int omap_vram_add_region(unsigned long paddr, size_t size) | ||
59 | { | ||
60 | struct vram_region *rm; | ||
61 | unsigned pages; | ||
62 | |||
63 | - DBG("adding region paddr %08lx size %d\n", | ||
64 | - paddr, size); | ||
65 | + if (vram_initialized) { | ||
66 | + DBG("adding region paddr %08lx size %d\n", | ||
67 | + paddr, size); | ||
68 | |||
69 | - size &= PAGE_MASK; | ||
70 | - pages = size >> PAGE_SHIFT; | ||
71 | + size &= PAGE_MASK; | ||
72 | + pages = size >> PAGE_SHIFT; | ||
73 | |||
74 | - rm = omap_vram_create_region(paddr, pages); | ||
75 | - if (rm == NULL) | ||
76 | - return -ENOMEM; | ||
77 | + rm = omap_vram_create_region(paddr, pages); | ||
78 | + if (rm == NULL) | ||
79 | + return -ENOMEM; | ||
80 | + | ||
81 | + list_add(&rm->list, ®ion_list); | ||
82 | + } else { | ||
83 | + if (postponed_cnt == MAX_POSTPONED_REGIONS) | ||
84 | + return -ENOMEM; | ||
85 | |||
86 | - list_add(&rm->list, ®ion_list); | ||
87 | + postponed_regions[postponed_cnt].paddr = paddr; | ||
88 | + postponed_regions[postponed_cnt].size = size; | ||
89 | |||
90 | + ++postponed_cnt; | ||
91 | + } | ||
92 | return 0; | ||
93 | } | ||
94 | |||
95 | @@ -438,6 +432,8 @@ static __init int omap_vram_init(void) | ||
96 | { | ||
97 | int i, r; | ||
98 | |||
99 | + vram_initialized = 1; | ||
100 | + | ||
101 | for (i = 0; i < postponed_cnt; i++) | ||
102 | omap_vram_add_region(postponed_regions[i].paddr, | ||
103 | postponed_regions[i].size); | ||
104 | @@ -472,10 +468,6 @@ static void __init omapfb_early_vram(char **p) | ||
105 | omapfb_def_sdram_vram_size = memparse(*p, p); | ||
106 | if (**p == ',') | ||
107 | omapfb_def_sdram_vram_start = simple_strtoul((*p) + 1, p, 16); | ||
108 | - | ||
109 | - printk("omapfb_early_vram, %d, 0x%x\n", | ||
110 | - omapfb_def_sdram_vram_size, | ||
111 | - omapfb_def_sdram_vram_start); | ||
112 | } | ||
113 | __early_param("vram=", omapfb_early_vram); | ||
114 | |||
115 | @@ -538,7 +530,7 @@ void __init omapfb_reserve_sdram(void) | ||
116 | BUG_ON(paddr & ~PAGE_MASK); | ||
117 | } | ||
118 | |||
119 | - omap_vram_add_region_postponed(paddr, size); | ||
120 | + omap_vram_add_region(paddr, size); | ||
121 | |||
122 | pr_info("Reserving %u bytes SDRAM for VRAM\n", size); | ||
123 | } | ||
124 | @@ -594,7 +586,7 @@ unsigned long __init omapfb_reserve_sram(unsigned long sram_pstart, | ||
125 | reserved = pend_avail - paddr; | ||
126 | size_avail = pend_avail - reserved - pstart_avail; | ||
127 | |||
128 | - omap_vram_add_region_postponed(paddr, size); | ||
129 | + omap_vram_add_region(paddr, size); | ||
130 | |||
131 | if (reserved) | ||
132 | pr_info("Reserving %lu bytes SRAM for VRAM\n", reserved); | ||
133 | -- | ||
134 | 1.5.6.5 | ||
135 | |||