diff options
-rw-r--r-- | arch/arm/mach-tegra/board.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-tegra/common.c | 24 |
2 files changed, 25 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/board.h b/arch/arm/mach-tegra/board.h index 85d02d501b63..b02adb2cfc20 100644 --- a/arch/arm/mach-tegra/board.h +++ b/arch/arm/mach-tegra/board.h @@ -102,6 +102,7 @@ void __init tegra_protected_aperture_init(unsigned long aperture); int __init tegra_init_board_info(void); void tegra_move_framebuffer(unsigned long to, unsigned long from, unsigned long size); +void tegra_clear_framebuffer(unsigned long to, unsigned long size); bool is_tegra_debug_uartport_hs(void); int get_tegra_uart_debug_port_id(void); int arb_lost_recovery(int scl_gpio, int sda_gpio); diff --git a/arch/arm/mach-tegra/common.c b/arch/arm/mach-tegra/common.c index 8364589e1ff6..4c5838b355f0 100644 --- a/arch/arm/mach-tegra/common.c +++ b/arch/arm/mach-tegra/common.c @@ -838,6 +838,30 @@ out: iounmap(to_io); } +void tegra_clear_framebuffer(unsigned long to, unsigned long size) +{ + void __iomem *to_io; + unsigned long i; + + BUG_ON(PAGE_ALIGN((unsigned long)to) != (unsigned long)to); + BUG_ON(PAGE_ALIGN(size) != size); + + to_io = ioremap(to, size); + if (!to_io) { + pr_err("%s: Failed to map target framebuffer\n", __func__); + return; + } + + if (pfn_valid(page_to_pfn(phys_to_page(to)))) { + for (i = 0 ; i < size; i += PAGE_SIZE) + memset(to_io + i, 0, PAGE_SIZE); + } else { + for (i = 0; i < size; i += 4) + writel(0, to_io + i); + } + iounmap(to_io); +} + void __init tegra_reserve(unsigned long carveout_size, unsigned long fb_size, unsigned long fb2_size) { |