Commit 01d3a5e7 authored by Haavard Skinnemoen's avatar Haavard Skinnemoen Committed by Linus Torvalds

atmel_lcdfb: don't initialize a pre-allocated framebuffer

If the user specified a fixed framebuffer address on the command line, it may
have been initialized already with a splash image or something, so we
shouldn't clear it.

Therefore, we should only initialize the framebuffer if we allocated it
ourselves.  This patch also updates the AVR32 setup code to clear the
framebuffer if it allocated it itself, i.e.  the user didn't provide a fixed
address or the reservation failed.

I've updated the at91 platform code as well so that it initializes the
framebuffer if it is located in SRAM, but I haven't tested that it actually
works.
Signed-off-by: default avatarHaavard Skinnemoen <hskinnemoen@atmel.com>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Cc: Nicolas FERRE <nicolas.ferre@rfo.atmel.com>
Cc: Andrew Victor <andrew@sanpeople.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 20e061fb
...@@ -539,6 +539,17 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) ...@@ -539,6 +539,17 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data)
at91_set_B_periph(AT91_PIN_PB28, 0); /* LCDD23 */ at91_set_B_periph(AT91_PIN_PB28, 0); /* LCDD23 */
#endif #endif
if (ARRAY_SIZE(lcdc_resources) > 2) {
void __iomem *fb;
struct resource *fb_res = &lcdc_resources[2];
size_t fb_len = fb_res->end - fb_res->start + 1;
fb = ioremap_writecombine(fb_res->start, fb_len);
if (fb) {
memset(fb, 0, fb_len);
iounmap(fb, fb_len);
}
}
lcdc_data = *data; lcdc_data = *data;
platform_device_register(&at91_lcdc_device); platform_device_register(&at91_lcdc_device);
} }
......
...@@ -381,6 +381,20 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) ...@@ -381,6 +381,20 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data)
at91_set_B_periph(AT91_PIN_PC24, 0); /* LCDD22 */ at91_set_B_periph(AT91_PIN_PC24, 0); /* LCDD22 */
at91_set_B_periph(AT91_PIN_PC25, 0); /* LCDD23 */ at91_set_B_periph(AT91_PIN_PC25, 0); /* LCDD23 */
#ifdef CONFIG_FB_INTSRAM
{
void __iomem *fb;
struct resource *fb_res = &lcdc_resources[2];
size_t fb_len = fb_res->end - fb_res->start + 1;
fb = ioremap_writecombine(fb_res->start, fb_len);
if (fb) {
memset(fb, 0, fb_len);
iounmap(fb, fb_len);
}
}
#endif
lcdc_data = *data; lcdc_data = *data;
platform_device_register(&at91_lcdc_device); platform_device_register(&at91_lcdc_device);
} }
......
...@@ -274,6 +274,8 @@ static int __init early_parse_fbmem(char *p) ...@@ -274,6 +274,8 @@ static int __init early_parse_fbmem(char *p)
printk(KERN_WARNING printk(KERN_WARNING
"Failed to allocate framebuffer memory\n"); "Failed to allocate framebuffer memory\n");
fbmem_size = 0; fbmem_size = 0;
} else {
memset(__va(fbmem_start), 0, fbmem_size);
} }
} }
......
...@@ -250,6 +250,8 @@ static int atmel_lcdfb_alloc_video_memory(struct atmel_lcdfb_info *sinfo) ...@@ -250,6 +250,8 @@ static int atmel_lcdfb_alloc_video_memory(struct atmel_lcdfb_info *sinfo)
return -ENOMEM; return -ENOMEM;
} }
memset(info->screen_base, 0, info->fix.smem_len);
return 0; return 0;
} }
...@@ -634,7 +636,6 @@ static int __init atmel_lcdfb_init_fbinfo(struct atmel_lcdfb_info *sinfo) ...@@ -634,7 +636,6 @@ static int __init atmel_lcdfb_init_fbinfo(struct atmel_lcdfb_info *sinfo)
struct fb_info *info = sinfo->info; struct fb_info *info = sinfo->info;
int ret = 0; int ret = 0;
memset_io(info->screen_base, 0, info->fix.smem_len);
info->var.activate |= FB_ACTIVATE_FORCE | FB_ACTIVATE_NOW; info->var.activate |= FB_ACTIVATE_FORCE | FB_ACTIVATE_NOW;
dev_info(info->device, dev_info(info->device,
...@@ -764,6 +765,11 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev) ...@@ -764,6 +765,11 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
info->screen_base = ioremap(info->fix.smem_start, info->fix.smem_len); info->screen_base = ioremap(info->fix.smem_start, info->fix.smem_len);
if (!info->screen_base) if (!info->screen_base)
goto release_intmem; goto release_intmem;
/*
* Don't clear the framebuffer -- someone may have set
* up a splash image.
*/
} else { } else {
/* alocate memory buffer */ /* alocate memory buffer */
ret = atmel_lcdfb_alloc_video_memory(sinfo); ret = atmel_lcdfb_alloc_video_memory(sinfo);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment