From: Cody Xie Date: Mon, 4 Mar 2013 12:43:15 +0000 (+0800) Subject: rk3188 : modify to support dedicated memory reserved for mali driver X-Git-Tag: firefly_0821_release~7488 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=8d61e468d11202e1918e6983b53d4b7d16805b18;p=firefly-linux-kernel-4.4.55.git rk3188 : modify to support dedicated memory reserved for mali driver --- diff --git a/arch/arm/mach-rk30/board-rk3168-LR097.c b/arch/arm/mach-rk30/board-rk3168-LR097.c index c96cc76c83fe..56b32e0fcb18 100755 --- a/arch/arm/mach-rk30/board-rk3168-LR097.c +++ b/arch/arm/mach-rk30/board-rk3168-LR097.c @@ -613,6 +613,25 @@ static struct platform_device device_fb = { }; #endif +#if defined(CONFIG_ARCH_RK3188) +static struct resource resource_mali[] = { + [0] = { + .name = "ump buf", + .start = 0, + .end = 0, + .flags = IORESOURCE_MEM, + }, + +}; + +static struct platform_device device_mali= { + .name = "mali400_ump", + .id = -1, + .num_resources = ARRAY_SIZE(resource_mali), + .resource = resource_mali, +}; +#endif + #if defined(CONFIG_LCDC0_RK3066B) || defined(CONFIG_LCDC0_RK3188) static struct resource resource_lcdc0[] = { [0] = { @@ -1453,6 +1472,9 @@ static struct platform_device *devices[] __initdata = { #ifdef CONFIG_MT5931_MT6622 &device_mt6622, #endif +#if defined(CONFIG_ARCH_RK3188) + &device_mali, +#endif }; static int rk_platform_add_display_devices(void) @@ -2213,10 +2235,18 @@ static void __init machine_rk30_board_init(void) #endif } +#define HD_SCREEN_SIZE 1920UL*1200UL*4*3 static void __init rk30_reserve(void) { - int ump_mem_phy_size=512*1024*1024; - board_mem_reserve_add("ump buf", ump_mem_phy_size); +#if defined(CONFIG_ARCH_RK3188) + /*if lcd resolution great than or equal to 1920*1200,reserve the ump memory */ + if(!(get_fb_size() < ALIGN(HD_SCREEN_SIZE,SZ_1M))) + { + int ump_mem_phy_size=512UL*1024UL*1024UL; + resource_mali[0].start = board_mem_reserve_add("ump buf", ump_mem_phy_size); + resource_mali[0].end = resource_mali[0].start + ump_mem_phy_size -1; + } +#endif #ifdef CONFIG_ION rk30_ion_pdata.heaps[0].base = board_mem_reserve_add("ion", ION_RESERVE_SIZE); #endif diff --git a/arch/arm/mach-rk30/board-rk3168-tb.c b/arch/arm/mach-rk30/board-rk3168-tb.c old mode 100755 new mode 100644 index 9b3cbd21722e..34141fa4c2c9 --- a/arch/arm/mach-rk30/board-rk3168-tb.c +++ b/arch/arm/mach-rk30/board-rk3168-tb.c @@ -568,6 +568,24 @@ static struct platform_device device_fb = { .resource = resource_fb, }; #endif +#if defined(CONFIG_ARCH_RK3188) +static struct resource resource_mali[] = { + [0] = { + .name = "ump buf", + .start = 0, + .end = 0, + .flags = IORESOURCE_MEM, + }, + +}; + +static struct platform_device device_mali= { + .name = "mali400_ump", + .id = -1, + .num_resources = ARRAY_SIZE(resource_mali), + .resource = resource_mali, +}; +#endif #if defined(CONFIG_LCDC0_RK3066B) || defined(CONFIG_LCDC0_RK3188) static struct resource resource_lcdc0[] = { @@ -1285,7 +1303,9 @@ static struct platform_device *devices[] __initdata = { #ifdef CONFIG_GPS_RK &rk_device_gps, #endif - +#if defined(CONFIG_ARCH_RK3188) + &device_mali, +#endif }; static int rk_platform_add_display_devices(void) @@ -1999,9 +2019,18 @@ static void __init machine_rk30_board_init(void) clk_set_rate(clk_get_sys("rk_serial.0", "uart"), 48*1000000); #endif } - +#define HD_SCREEN_SIZE 1920UL*1200UL*4*3 static void __init rk30_reserve(void) { +#if defined(CONFIG_ARCH_RK3188) + /*if lcd resolution great than or equal to 1920*1200,reserve the ump memory */ + if(!(get_fb_size() < ALIGN(HD_SCREEN_SIZE,SZ_1M))) + { + int ump_mem_phy_size=512UL*1024UL*1024UL; + resource_mali[0].start = board_mem_reserve_add("ump buf", ump_mem_phy_size); + resource_mali[0].end = resource_mali[0].start + ump_mem_phy_size -1; + } +#endif #ifdef CONFIG_ION rk30_ion_pdata.heaps[0].base = board_mem_reserve_add("ion", ION_RESERVE_SIZE); #endif diff --git a/arch/arm/mach-rk3188/board-rk3188-ds1006h.c b/arch/arm/mach-rk3188/board-rk3188-ds1006h.c index c0060aebe3fa..9fc532ac64ec 100755 --- a/arch/arm/mach-rk3188/board-rk3188-ds1006h.c +++ b/arch/arm/mach-rk3188/board-rk3188-ds1006h.c @@ -506,6 +506,25 @@ static struct platform_device device_fb = { }; #endif +#if defined(CONFIG_ARCH_RK3188) +static struct resource resource_mali[] = { + [0] = { + .name = "ump buf", + .start = 0, + .end = 0, + .flags = IORESOURCE_MEM, + }, + +}; + +static struct platform_device device_mali= { + .name = "mali400_ump", + .id = -1, + .num_resources = ARRAY_SIZE(resource_mali), + .resource = resource_mali, +}; +#endif + #if defined(CONFIG_LCDC0_RK3188) static struct resource resource_lcdc0[] = { [0] = { @@ -1212,6 +1231,9 @@ static struct platform_device *devices[] __initdata = { #if defined(CONFIG_MT6229) &rk29_device_mt6229, #endif +#if defined(CONFIG_ARCH_RK3188) + &device_mali, +#endif }; @@ -1910,8 +1932,18 @@ static void __init machine_rk30_board_init(void) #endif } +#define HD_SCREEN_SIZE 1920UL*1200UL*4*3 static void __init rk30_reserve(void) { +#if defined(CONFIG_ARCH_RK3188) + /*if lcd resolution great than or equal to 1920*1200,reserve the ump memory */ + if(!(get_fb_size() < ALIGN(HD_SCREEN_SIZE,SZ_1M))) + { + int ump_mem_phy_size=512UL*1024UL*1024UL; + resource_mali[0].start = board_mem_reserve_add("ump buf", ump_mem_phy_size); + resource_mali[0].end = resource_mali[0].start + ump_mem_phy_size -1; + } +#endif #ifdef CONFIG_ION rk30_ion_pdata.heaps[0].base = board_mem_reserve_add("ion", ION_RESERVE_SIZE); #endif