arm: tegra: cardhu: Fix the issue of boot screen corruption.
Kevin Huang [Wed, 6 Jul 2011 01:27:43 +0000 (18:27 -0700)]
- The issue is due to the corruption of bootloader fb during kernel
initialization. This change reserves the bootloader fb and then
frees it until bootloader fb is copied to fb for Cardhu, Ventana,
Whistler, Enterprise and Aruba.
- Change color depth of Cardhu and Harmony to 32-bit.

Bug 828271
Bug 832016

Original-Change-Id: I05ef5930ee68dcbd672a5cb59b4568a2c88a2e55
Reviewed-on: http://git-master/r/34966
Reviewed-by: Varun Colbert <vcolbert@nvidia.com>
Tested-by: Varun Colbert <vcolbert@nvidia.com>

Rebase-Id: Rb3c9280ea4643ccee661d37d24fb540319470bf7

13 files changed:
arch/arm/mach-tegra/board-aruba-panel.c
arch/arm/mach-tegra/board-aruba.c
arch/arm/mach-tegra/board-cardhu-panel.c
arch/arm/mach-tegra/board-cardhu.c
arch/arm/mach-tegra/board-enterprise-panel.c
arch/arm/mach-tegra/board-enterprise.c
arch/arm/mach-tegra/board-harmony-panel.c
arch/arm/mach-tegra/board-ventana-panel.c
arch/arm/mach-tegra/board-ventana.c
arch/arm/mach-tegra/board-whistler-panel.c
arch/arm/mach-tegra/board-whistler.c
arch/arm/mach-tegra/board.h
arch/arm/mach-tegra/common.c

index 5db69f6..deb2a08 100644 (file)
@@ -228,6 +228,10 @@ int __init aruba_panel_init(void)
        res->start = tegra_fb_start;
        res->end = tegra_fb_start + tegra_fb_size - 1;
 
+       /* Copy the bootloader fb to the fb. */
+       tegra_move_framebuffer(tegra_fb_start, tegra_bootloader_fb_start,
+                               min(tegra_fb_size, tegra_bootloader_fb_size));
+
        if (!err)
                err = nvhost_device_register(&aruba_disp1_device);
 
index 0f0befe..df7d4c6 100644 (file)
@@ -493,6 +493,7 @@ static void __init tegra_aruba_init(void)
        aruba_sensors_init();
        aruba_bt_rfkill();
        aruba_sata_init();
+       tegra_release_bootloader_fb();
 }
 
 static void __init tegra_aruba_reserve(void)
index 2d7398f..1f7c2bc 100644 (file)
@@ -499,6 +499,7 @@ static struct tegra_fb_data cardhu_fb_data = {
        .xres           = 1366,
        .yres           = 768,
        .bits_per_pixel = 32,
+       .flags          = TEGRA_FB_FLIP_ON_PROBE,
 };
 
 static struct tegra_fb_data cardhu_hdmi_fb_data = {
@@ -506,6 +507,7 @@ static struct tegra_fb_data cardhu_hdmi_fb_data = {
        .xres           = 1366,
        .yres           = 768,
        .bits_per_pixel = 32,
+       .flags          = TEGRA_FB_FLIP_ON_PROBE,
 };
 
 static struct tegra_dc_out cardhu_disp2_out = {
@@ -781,6 +783,7 @@ static struct tegra_fb_data cardhu_dsi_fb_data = {
        .yres           = 480,
        .bits_per_pixel = 32,
 #endif
+       .flags          = TEGRA_FB_FLIP_ON_PROBE,
 };
 
 
@@ -899,6 +902,10 @@ int __init cardhu_panel_init(void)
        res->start = tegra_fb_start;
        res->end = tegra_fb_start + tegra_fb_size - 1;
 
+       /* Copy the bootloader fb to the fb. */
+       tegra_move_framebuffer(tegra_fb_start, tegra_bootloader_fb_start,
+                               min(tegra_fb_size, tegra_bootloader_fb_size));
+
        if (!err)
                err = nvhost_device_register(&cardhu_disp1_device);
 
index 051a0c8..cc3df08 100644 (file)
@@ -662,6 +662,7 @@ static void __init tegra_cardhu_init(void)
        //audio_wired_jack_init();
        cardhu_pins_state_init();
        cardhu_emc_init();
+       tegra_release_bootloader_fb();
 }
 
 static void __init tegra_cardhu_reserve(void)
index c2c31ba..e64a031 100644 (file)
@@ -309,7 +309,8 @@ static struct tegra_fb_data enterprise_hdmi_fb_data = {
        .win            = 0,
        .xres           = 1366,
        .yres           = 768,
-       .bits_per_pixel = 16,
+       .bits_per_pixel = 32,
+       .flags          = TEGRA_FB_FLIP_ON_PROBE,
 };
 
 static struct tegra_dc_out enterprise_disp2_out = {
@@ -499,6 +500,7 @@ static struct tegra_fb_data enterprise_dsi_fb_data = {
        .xres           = 540,
        .yres           = 960,
        .bits_per_pixel = 32,
+       .flags          = TEGRA_FB_FLIP_ON_PROBE,
 };
 
 
@@ -611,6 +613,10 @@ int __init enterprise_panel_init(void)
        res->start = tegra_fb_start;
        res->end = tegra_fb_start + tegra_fb_size - 1;
 
+       /* Copy the bootloader fb to the fb. */
+       tegra_move_framebuffer(tegra_fb_start, tegra_bootloader_fb_start,
+               min(tegra_fb_size, tegra_bootloader_fb_size));
+
        if (!err)
                err = nvhost_device_register(&enterprise_disp1_device);
 
index 981bbdb..23a13a9 100644 (file)
@@ -422,6 +422,7 @@ static void __init tegra_enterprise_init(void)
        enterprise_emc_init();
        enterprise_sensors_init();
        enterprise_suspend_init();
+       tegra_release_bootloader_fb();
 }
 
 static void __init tegra_enterprise_reserve(void)
index 309d72e..a7890a7 100644 (file)
@@ -45,7 +45,7 @@ static struct tegra_fb_lcd_data tegra_fb_lcd_platform_data = {
        .lcd_yres       = 600,
        .fb_xres        = 1024,
        .fb_yres        = 600,
-       .bits_per_pixel = 16,
+       .bits_per_pixel = 32,
 };
 
 static struct platform_device tegra_fb_device = {
index 8aeee02..6563e7c 100644 (file)
@@ -215,6 +215,7 @@ static struct tegra_fb_data ventana_fb_data = {
        .xres           = 1366,
        .yres           = 768,
        .bits_per_pixel = 32,
+       .flags          = TEGRA_FB_FLIP_ON_PROBE,
 };
 
 static struct tegra_fb_data ventana_hdmi_fb_data = {
@@ -222,6 +223,7 @@ static struct tegra_fb_data ventana_hdmi_fb_data = {
        .xres           = 1366,
        .yres           = 768,
        .bits_per_pixel = 32,
+       .flags          = TEGRA_FB_FLIP_ON_PROBE,
 };
 
 static struct tegra_dc_out ventana_disp1_out = {
@@ -357,6 +359,10 @@ int __init ventana_panel_init(void)
        res->start = tegra_fb2_start;
        res->end = tegra_fb2_start + tegra_fb2_size - 1;
 
+       /* Copy the bootloader fb to the fb. */
+       tegra_move_framebuffer(tegra_fb_start, tegra_bootloader_fb_start,
+               min(tegra_fb_size, tegra_bootloader_fb_size));
+
        if (!err)
                err = nvhost_device_register(&ventana_disp1_device);
 
index 31a848a..760ff72 100644 (file)
@@ -540,6 +540,7 @@ static void __init tegra_ventana_init(void)
        ventana_bt_rfkill();
        ventana_power_off_init();
        ventana_emc_init();
+       tegra_release_bootloader_fb();
 }
 
 int __init tegra_ventana_protected_aperture_init(void)
index d41459f..9603b69 100644 (file)
@@ -207,6 +207,7 @@ static struct tegra_fb_data whistler_fb_data = {
        .xres           = 800,
        .yres           = 480,
        .bits_per_pixel = 32,
+       .flags          = TEGRA_FB_FLIP_ON_PROBE,
 };
 
 static struct tegra_fb_data whistler_hdmi_fb_data = {
@@ -214,6 +215,7 @@ static struct tegra_fb_data whistler_hdmi_fb_data = {
        .xres           = 800,
        .yres           = 480,
        .bits_per_pixel = 32,
+       .flags          = TEGRA_FB_FLIP_ON_PROBE,
 };
 
 
@@ -299,6 +301,10 @@ int __init whistler_panel_init(void)
        res->start = tegra_fb_start;
        res->end = tegra_fb_start + tegra_fb_size - 1;
 
+       /* Copy the bootloader fb to the fb. */
+       tegra_move_framebuffer(tegra_fb_start, tegra_bootloader_fb_start,
+               min(tegra_fb_size, tegra_bootloader_fb_size));
+
        res = nvhost_get_resource_byname(&whistler_disp2_device,
                                         IORESOURCE_MEM, "fbmem");
        res->start = tegra_fb2_start;
index e324442..db827fd 100644 (file)
@@ -392,6 +392,7 @@ static void __init tegra_whistler_init(void)
        whistler_power_off_init();
        whistler_emc_init();
        whistler_baseband_init();
+       tegra_release_bootloader_fb();
 }
 
 int __init tegra_whistler_protected_aperture_init(void)
index 2665a6f..eaba871 100644 (file)
@@ -42,6 +42,7 @@ void __init tegra_reserve(unsigned long carveout_size, unsigned long fb_size,
        unsigned long fb2_size);
 int __init tegra_pcie_init(bool init_port0, bool init_port1);
 void tegra_init_cache(void);
+void __init tegra_release_bootloader_fb(void);
 void __init tegra_protected_aperture_init(unsigned long aperture);
 void __init tegra_tsensor_init(void);
 void tegra_move_framebuffer(unsigned long to, unsigned long from,
index 9839708..1c621bc 100644 (file)
@@ -499,7 +499,7 @@ void tegra_move_framebuffer(unsigned long to, unsigned long from,
                        goto out;
                }
 
-               for (i = 0; i < size; i+= 4)
+               for (i = 0; i < size; i += 4)
                        writel(readl(from_io + i), to_io + i);
 
                iounmap(from_io);
@@ -542,16 +542,15 @@ void __init tegra_reserve(unsigned long carveout_size, unsigned long fb_size,
                                carveout_size, tegra_carveout_start);
                        tegra_carveout_start = 0;
                        tegra_carveout_size = 0;
-               }
-               else
+               } else
                        tegra_carveout_size = carveout_size;
        }
 
        if (fb2_size) {
                tegra_fb2_start = memblock_end_of_DRAM() - fb2_size;
                if (memblock_remove(tegra_fb2_start, fb2_size)) {
-                       pr_err("Failed to remove second framebuffer %08lx@%08lx "
-                               "from memory map\n",
+                       pr_err("Failed to remove second framebuffer "
+                               "%08lx@%08lx from memory map\n",
                                fb2_size, tegra_fb2_start);
                        tegra_fb2_start = 0;
                        tegra_fb2_size = 0;
@@ -606,17 +605,20 @@ void __init tegra_reserve(unsigned long carveout_size, unsigned long fb_size,
 #endif
 
        /*
-        * TODO: We should copy the bootloader's framebuffer to the framebuffer
-        * allocated above, and then free this one.
-        */
-       if (tegra_bootloader_fb_size)
+        * We copy the bootloader's framebuffer to the framebuffer allocated
+        * above, and then free this one.
+        * */
+       if (tegra_bootloader_fb_size) {
+               tegra_bootloader_fb_size = PAGE_ALIGN(tegra_bootloader_fb_size);
                if (memblock_reserve(tegra_bootloader_fb_start,
                                tegra_bootloader_fb_size)) {
-                       pr_err("Failed to reserve bootloader frame buffer %08lx@%08lx\n",
-                               tegra_bootloader_fb_size, tegra_bootloader_fb_start);
+                       pr_err("Failed to reserve bootloader frame buffer "
+                               "%08lx@%08lx\n", tegra_bootloader_fb_size,
+                               tegra_bootloader_fb_start);
                        tegra_bootloader_fb_start = 0;
                        tegra_bootloader_fb_size = 0;
                }
+       }
 
        pr_info("Tegra reserved memory:\n"
                "LP0:                    %08lx - %08lx\n"
@@ -646,3 +648,12 @@ void __init tegra_reserve(unsigned long carveout_size, unsigned long fb_size,
                        smmu_window->start, smmu_window->end);
 #endif
 }
+
+void __init tegra_release_bootloader_fb(void)
+{
+       /* Since bootloader fb is reserved in common.c, it is freed here. */
+       if (tegra_bootloader_fb_size)
+               if (memblock_free(tegra_bootloader_fb_start,
+                                               tegra_bootloader_fb_size))
+                       pr_err("Failed to free bootloader fb.\n");
+}