From 01d3a5e7fab7732cfc5d5d4533e9378ea435295a Mon Sep 17 00:00:00 2001 From: Haavard Skinnemoen Date: Mon, 28 Apr 2008 02:15:19 -0700 Subject: 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: Haavard Skinnemoen Cc: "Antonino A. Daplas" Cc: Nicolas FERRE Cc: Andrew Victor Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/arm/mach-at91/at91sam9261_devices.c | 11 +++++++++++ arch/arm/mach-at91/at91sam9rl_devices.c | 14 ++++++++++++++ 2 files changed, 25 insertions(+) (limited to 'arch/arm/mach-at91') diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c index 37cd547855b..728bb8f3944 100644 --- a/arch/arm/mach-at91/at91sam9261_devices.c +++ b/arch/arm/mach-at91/at91sam9261_devices.c @@ -539,6 +539,17 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) at91_set_B_periph(AT91_PIN_PB28, 0); /* LCDD23 */ #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; platform_device_register(&at91_lcdc_device); } diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c index dbb9a5fc209..054689804e7 100644 --- a/arch/arm/mach-at91/at91sam9rl_devices.c +++ b/arch/arm/mach-at91/at91sam9rl_devices.c @@ -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_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; platform_device_register(&at91_lcdc_device); } -- cgit v1.2.3