summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJong Kim <jongk@nvidia.com>2011-09-06 18:03:09 -0700
committerVarun Colbert <vcolbert@nvidia.com>2011-09-08 17:21:01 -0700
commit9e7bf6bd080289b9381c6e1602207535eec5a613 (patch)
tree87acc56ad84f54c3562cd54824ee513a169be26e
parent78ba6a0e051352b4b197f05dcacd4b6eb6fa8589 (diff)
arm: tegra: Add Dynamic carveout support for Harmony
Removed hard-coded physical addresses for carveout and fb, and uses tegra_reserve() to reserve carveout and fb from kernel memory pool. This change matches the default kernel config option "KERNEL_ON_MMU", which removes/ignores "nvmem=xxx" command line option usage. (lastest fastboot removed this option from cmdline). BUGS=871874 TESTS=Ubuntu desktop works when flashed without cmdline work around. Change-Id: I5222398543d5f6e88367814c1dbc669fdb49dc54 Signed-off-by: Jong Kim <jongk@nvidia.com> Reviewed-on: http://git-master/r/50943 Reviewed-by: Allen Martin <amartin@nvidia.com>
-rw-r--r--arch/arm/mach-tegra/board-harmony-panel.c34
-rw-r--r--arch/arm/mach-tegra/board-harmony.c21
2 files changed, 40 insertions, 15 deletions
diff --git a/arch/arm/mach-tegra/board-harmony-panel.c b/arch/arm/mach-tegra/board-harmony-panel.c
index 5bb70205717d..94baae1181b7 100644
--- a/arch/arm/mach-tegra/board-harmony-panel.c
+++ b/arch/arm/mach-tegra/board-harmony-panel.c
@@ -34,6 +34,7 @@
#include "devices.h"
#include "gpio-names.h"
+#include "board.h"
#define harmony_bl_enb TEGRA_GPIO_PB5
#define harmony_lvds_shutdown TEGRA_GPIO_PB2
@@ -164,8 +165,6 @@ static struct resource harmony_disp1_resources[] = {
},
{
.name = "fbmem",
- .start = 0x1c012000,
- .end = 0x1c012000 + 0x258000 - 1,
.flags = IORESOURCE_MEM,
},
};
@@ -184,6 +183,10 @@ static struct resource harmony_disp2_resources[] = {
.flags = IORESOURCE_MEM,
},
{
+ .name = "fbmem",
+ .flags = IORESOURCE_MEM,
+ },
+ {
.name = "hdmi_regs",
.start = TEGRA_HDMI_BASE,
.end = TEGRA_HDMI_BASE + TEGRA_HDMI_SIZE - 1,
@@ -296,8 +299,6 @@ static struct nvmap_platform_carveout harmony_carveouts[] = {
[1] = {
.name = "generic-0",
.usage_mask = NVMAP_HEAP_CARVEOUT_GENERIC,
- .base = 0x18C00000,
- .size = SZ_128M - 0xC00000,
.buddy_size = SZ_32K,
},
};
@@ -325,6 +326,7 @@ static struct platform_device *harmony_gfx_devices[] __initdata = {
int __init harmony_panel_init(void)
{
int err;
+ struct resource *res;
gpio_request(harmony_en_vdd_pnl, "en_vdd_pnl");
gpio_direction_output(harmony_en_vdd_pnl, 1);
@@ -342,8 +344,31 @@ int __init harmony_panel_init(void)
gpio_direction_input(harmony_hdmi_hpd);
tegra_gpio_enable(harmony_hdmi_hpd);
+ harmony_carveouts[1].base = tegra_carveout_start;
+ harmony_carveouts[1].size = tegra_carveout_size;
+
err = platform_add_devices(harmony_gfx_devices,
ARRAY_SIZE(harmony_gfx_devices));
+ if (err)
+ goto fail;
+
+ res = nvhost_get_resource_byname(&harmony_disp1_device,
+ IORESOURCE_MEM, "fbmem");
+ if (res) {
+ res->start = tegra_fb_start;
+ res->end = tegra_fb_start + tegra_fb_size - 1;
+ }
+
+ res = nvhost_get_resource_byname(&harmony_disp2_device,
+ IORESOURCE_MEM, "fbmem");
+ if (res) {
+ 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(&harmony_disp1_device);
@@ -351,6 +376,7 @@ int __init harmony_panel_init(void)
if (!err)
err = nvhost_device_register(&harmony_disp2_device);
+fail:
return err;
}
diff --git a/arch/arm/mach-tegra/board-harmony.c b/arch/arm/mach-tegra/board-harmony.c
index e861bfeef132..ec040c3da009 100644
--- a/arch/arm/mach-tegra/board-harmony.c
+++ b/arch/arm/mach-tegra/board-harmony.c
@@ -29,6 +29,7 @@
#include <linux/delay.h>
#include <linux/gpio.h>
#include <linux/platform_data/tegra_usb.h>
+#include <linux/memblock.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
@@ -277,16 +278,6 @@ static struct platform_device *harmony_devices[] __initdata = {
&tegra_i2s_device1,
};
-static void __init tegra_harmony_fixup(struct machine_desc *desc,
- struct tag *tags, char **cmdline, struct meminfo *mi)
-{
- mi->nr_banks = 2;
- mi->bank[0].start = PHYS_OFFSET;
- mi->bank[0].size = 448 * SZ_1M;
- mi->bank[1].start = SZ_512M;
- mi->bank[1].size = SZ_512M;
-}
-
static __initdata struct tegra_clk_init_table harmony_clk_init_table[] = {
/* name parent rate enabled */
{ "clk_dev1", NULL, 26000000, true},
@@ -435,13 +426,21 @@ static void __init tegra_harmony_init(void)
harmony_power_off_init();
}
+void __init tegra_harmony_reserve(void)
+{
+ if (memblock_reserve(0x0, 4096) < 0)
+ pr_warn("Cannot reserve first 4K of memory for safety\n");
+
+ tegra_reserve(SZ_128M, SZ_8M, SZ_16M);
+}
+
MACHINE_START(HARMONY, "harmony")
.boot_params = 0x00000100,
.phys_io = IO_APB_PHYS,
.io_pg_offst = ((IO_APB_VIRT) >> 18) & 0xfffc,
- .fixup = tegra_harmony_fixup,
.init_irq = tegra_init_irq,
.init_machine = tegra_harmony_init,
.map_io = tegra_map_common_io,
+ .reserve = tegra_harmony_reserve,
.timer = &tegra_timer,
MACHINE_END