aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/mm
diff options
context:
space:
mode:
authorMagnus Damm <damm@igel.co.jp>2008-08-11 02:13:24 -0400
committerPaul Mundt <lethal@linux-sh.org>2008-08-11 07:17:55 -0400
commit0c13bf1e7c98668ce69eaedd215ec32f9e1361ae (patch)
treeaaf5fc79baecd9789bb7161d9cc87e6dec051af5 /arch/sh/mm
parent2a5323cd69ff485c1b68960f2b4802cf252558f1 (diff)
sh: select memchunk size using kernel cmdline
Allow user to pass parameters on kernel command line to override default size for physically contiguous memory buffers. The default VPU buffer size is too small for VGA harware encoding, but instead of just bumping up the number we allow the user to override the default size using the command line. Supports SuperH Mobile hardware blocks such as VEU, VPU and CEU. Signed-off-by: Magnus Damm <damm@igel.co.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/mm')
-rw-r--r--arch/sh/mm/consistent.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c
index b2ce014401b5..895bb3f335c7 100644
--- a/arch/sh/mm/consistent.c
+++ b/arch/sh/mm/consistent.c
@@ -95,6 +95,29 @@ void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
95} 95}
96EXPORT_SYMBOL(dma_cache_sync); 96EXPORT_SYMBOL(dma_cache_sync);
97 97
98static int __init memchunk_setup(char *str)
99{
100 return 1; /* accept anything that begins with "memchunk." */
101}
102__setup("memchunk.", memchunk_setup);
103
104static void memchunk_cmdline_override(char *name, unsigned long *sizep)
105{
106 char *p = boot_command_line;
107 int k = strlen(name);
108
109 while ((p = strstr(p, "memchunk."))) {
110 p += 9; /* strlen("memchunk.") */
111 if (!strncmp(name, p, k) && p[k] == '=') {
112 p += k + 1;
113 *sizep = memparse(p, NULL);
114 pr_info("%s: forcing memory chunk size to 0x%08lx\n",
115 name, *sizep);
116 break;
117 }
118 }
119}
120
98int platform_resource_setup_memory(struct platform_device *pdev, 121int platform_resource_setup_memory(struct platform_device *pdev,
99 char *name, unsigned long memsize) 122 char *name, unsigned long memsize)
100{ 123{
@@ -109,6 +132,10 @@ int platform_resource_setup_memory(struct platform_device *pdev,
109 return -EINVAL; 132 return -EINVAL;
110 } 133 }
111 134
135 memchunk_cmdline_override(name, &memsize);
136 if (!memsize)
137 return 0;
138
112 buf = dma_alloc_coherent(NULL, memsize, &dma_handle, GFP_KERNEL); 139 buf = dma_alloc_coherent(NULL, memsize, &dma_handle, GFP_KERNEL);
113 if (!buf) { 140 if (!buf) {
114 pr_warning("%s: unable to allocate memory\n", name); 141 pr_warning("%s: unable to allocate memory\n", name);