summaryrefslogtreecommitdiff
path: root/arch/arm/mach-tegra/board-cardhu-panel.c
diff options
context:
space:
mode:
authorScott Williams <scwilliams@nvidia.com>2011-01-11 10:50:52 -0800
committerDan Willemsen <dwillemsen@nvidia.com>2011-11-30 21:45:28 -0800
commitab539843d40c71944662e4c0e476575ffacc84ae (patch)
treed6f09352c171cdf8f30bd94c280bce6a6d683ebb /arch/arm/mach-tegra/board-cardhu-panel.c
parentbe7063d410d8353d492b60dd6397d1f5e42287db (diff)
arm: tegra: Fix hardcoded frame buffer addresses
Dynamically obtain the carveout and framebuffer addresses. Bug 769986 Original-Change-Id: I9b8eeb710e5198ab9ae4e7e6c7095cfd23209e66 Reviewed-on: http://git-master/r/15534 Tested-by: Scott Williams <scwilliams@nvidia.com> Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-by: Krishna Reddy <vdumpa@nvidia.com> Reviewed-by: Jonathan Mayo <jmayo@nvidia.com> Reviewed-by: Scott Williams <scwilliams@nvidia.com> Original-Change-Id: Ia6f68817b65281bd5da4f8774476a947fd970950 Rebase-Id: Rd777de7904d1fcd0fc300245929ffd401a8f5cc4
Diffstat (limited to 'arch/arm/mach-tegra/board-cardhu-panel.c')
-rw-r--r--arch/arm/mach-tegra/board-cardhu-panel.c89
1 files changed, 15 insertions, 74 deletions
diff --git a/arch/arm/mach-tegra/board-cardhu-panel.c b/arch/arm/mach-tegra/board-cardhu-panel.c
index 2ee1a20da14e..31cb9b9f6fa6 100644
--- a/arch/arm/mach-tegra/board-cardhu-panel.c
+++ b/arch/arm/mach-tegra/board-cardhu-panel.c
@@ -32,11 +32,10 @@
#include <mach/dc.h>
#include <mach/fb.h>
+#include "board.h"
#include "devices.h"
#include "gpio-names.h"
-#define PMC_SCRATCH20 0xa0
-
#define cardhu_lvds_shutdown TEGRA_GPIO_PB2
#define cardhu_bl_enb TEGRA_GPIO_PW1
@@ -124,8 +123,8 @@ static struct resource cardhu_disp1_resources[] = {
},
{
.name = "fbmem",
- .start = 0, /* Filled in by fbmem_set() */
- .end = 0, /* Filled in by fbmem_set() */
+ .start = 0, /* Filled in by cardhu_panel_init() */
+ .end = 0, /* Filled in by cardhu_panel_init() */
.flags = IORESOURCE_MEM,
},
};
@@ -193,8 +192,8 @@ static struct nvmap_platform_carveout cardhu_carveouts[] = {
[1] = {
.name = "generic-0",
.usage_mask = NVMAP_HEAP_CARVEOUT_GENERIC,
- .base = 0, /* Filled in by carveout_set() */
- .size = 0, /* Filled in by carveout_set() */
+ .base = 0, /* Filled in by cardhu_panel_init() */
+ .size = 0, /* Filled in by cardhu_panel_init() */
.buddy_size = SZ_32K,
},
};
@@ -220,79 +219,21 @@ static struct platform_device *cardhu_gfx_devices[] __initdata = {
};
-static inline u32 pmc_readl(unsigned long offset)
-{
- return readl(IO_TO_VIRT(TEGRA_PMC_BASE + offset));
-}
-
-static void fbmem_set(struct resource *res, int num_res,
- u32 start, resource_size_t size)
-{
- int i;
- for (i = 0; i < num_res ; i++) {
- if (!strcmp(res[i].name, "fbmem")) {
- res[i].start = start;
- res[i].end = start + size - 1;
- return;
- }
- }
- /* Didn't find a framebuffer memory resource */
- BUG();
-}
-
-static void carveout_set(struct nvmap_platform_carveout *res, int num_res,
- u32 base, resource_size_t size)
-{
- int i;
- for (i = 0; i < num_res ; i++) {
- if (!strcmp(res[i].name, "generic-0")) {
- res[i].base = base;
- res[i].size = size;
- return;
- }
- }
- /* Didn't find a carveout memory resource */
- BUG();
-}
-
int __init cardhu_panel_init(void)
{
int err;
- u32 odm_data = pmc_readl(PMC_SCRATCH20);
-
- /* !!!FIXME!!! HAVE TO USE HARD-CODED FRAME BUFFER AND CARVEOUT
- ADDRESSES FOR NOW -- BUG 769986 */
- switch (odm_data & 0x70000000) {
- case 0x10000000:
- /* 256MB LPDDR2 */
- fbmem_set(cardhu_disp1_resources,
- ARRAY_SIZE(cardhu_disp1_resources),
- 0x8E010000,
- 0x0012C3C0);
- carveout_set(cardhu_carveouts,
- ARRAY_SIZE(cardhu_carveouts),
- 0x8EC00000, /* 256MB mem - 32MB carveout + 0xC00000 ?*/
- SZ_32M - 0xC00000);
- break;
- case 0x40000000:
- /* 1GB DDR3 -- NOTE: The bootloader cannot map more than 512MB
- of physical memory. Therefore, the frame buffer and carveout
- must be completely below the 512MB boundary. */
- fbmem_set(cardhu_disp1_resources,
- ARRAY_SIZE(cardhu_disp1_resources),
- 0x9E010000,
- 0x0012C3C0);
- carveout_set(cardhu_carveouts,
- ARRAY_SIZE(cardhu_carveouts),
- 0x9EC00000, /* 512MB mem - 32MB carveout + 0xC00000 ?*/
- SZ_32M - 0xC00000);
- break;
- default:
- BUG();
- }
+ struct resource *res;
+
+ cardhu_carveouts[1].base = tegra_carveout_start;
+ cardhu_carveouts[1].size = tegra_carveout_size;
err = platform_add_devices(cardhu_gfx_devices,
- ARRAY_SIZE(cardhu_gfx_devices));
+ ARRAY_SIZE(cardhu_gfx_devices));
+
+ res = nvhost_get_resource_byname(&cardhu_disp1_device,
+ IORESOURCE_MEM, "fbmem");
+ res->start = tegra_fb_start;
+ res->end = tegra_fb_start + tegra_fb_size - 1;
if (!err)
err = nvhost_device_register(&cardhu_disp1_device);