rk3188 : modify to support dedicated memory reserved for mali driver
authorCody Xie <xkd@rock-chips.com>
Mon, 4 Mar 2013 12:43:15 +0000 (20:43 +0800)
committerCody Xie <xkd@rock-chips.com>
Mon, 4 Mar 2013 12:43:15 +0000 (20:43 +0800)
arch/arm/mach-rk30/board-rk3168-LR097.c
arch/arm/mach-rk30/board-rk3168-tb.c [changed mode: 0755->0644]
arch/arm/mach-rk3188/board-rk3188-ds1006h.c

index c96cc76c83fec3f12ccbd736601d6bde3766ccee..56b32e0fcb18f92c41b0125674b5d4925562d8d4 100755 (executable)
@@ -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
old mode 100755 (executable)
new mode 100644 (file)
index 9b3cbd2..34141fa
@@ -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
index c0060aebe3fa09c69877bbf567bec57a6559cf9d..9fc532ac64ec7c79075bc819d7677310a57607c2 100755 (executable)
@@ -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