arm: tegra12: enable VPR for Tegra split mem
Adeel Raza [Fri, 19 Apr 2013 23:25:20 +0000 (16:25 -0700)]
Make room for the VPR carveout in the front door memory region of the
Tegra split memory config.

Change-Id: I0b32fb430df651050c9e6d6c25cbbd9a3f81e82d
Signed-off-by: Adeel Raza <araza@nvidia.com>
Reviewed-on: http://git-master/r/221341
Reviewed-by: Alexander Van Brunt <avanbrunt@nvidia.com>

arch/arm/mach-tegra/common.c
arch/arm/mach-tegra/iomap.h

index 7fb9f21..162c6f6 100644 (file)
@@ -1754,10 +1754,77 @@ void __init tegra_reserve(unsigned long carveout_size, unsigned long fb_size,
 
 #ifdef CONFIG_TEGRA_SIMULATION_SPLIT_MEM
        if (tegra_split_mem_active()) {
-               tegra_carveout_start = TEGRA_ASIM_QT_CARVEOUT_START;
-               tegra_carveout_size = TEGRA_ASIM_QT_CARVEOUT_SIZE;
                tegra_fb_start = TEGRA_ASIM_QT_FB_START;
                tegra_fb_size = TEGRA_ASIM_QT_FB_SIZE;
+
+               if (tegra_vpr_size == 0) {
+                       tegra_carveout_start =
+                               TEGRA_ASIM_QT_CARVEOUT_VPR_DISABLED_START;
+                       tegra_carveout_size =
+                               TEGRA_ASIM_QT_CARVEOUT_VPR_DISABLED_SIZE;
+               } else if (
+                       (tegra_vpr_start <
+                               TEGRA_ASIM_QT_FB_START +
+                               TEGRA_ASIM_QT_FB_SIZE) ||
+                       (tegra_vpr_start + tegra_vpr_size - 1 >
+                               TEGRA_ASIM_QT_FRONT_DOOR_MEM_START +
+                               TEGRA_ASIM_QT_FRONT_DOOR_MEM_SIZE - 1)) {
+                       /*
+                        * On ASIM/ASIM + QT with
+                        * CONFIG_TEGRA_SIMULATION_SPLIT_MEM enabled, the VPR
+                        * region needs to be within the front door memory
+                        * region. Moreover, the VPR region can't exist where
+                        * the framebuffer resides.
+                        */
+                       BUG();
+               } else if (
+                       (tegra_vpr_start -
+                       (TEGRA_ASIM_QT_FB_START +
+                       TEGRA_ASIM_QT_FB_SIZE) <
+                               TEGRA_ASIM_QT_CARVEOUT_MIN_SIZE) &&
+                       (TEGRA_ASIM_QT_FRONT_DOOR_MEM_START +
+                       TEGRA_ASIM_QT_FRONT_DOOR_MEM_SIZE -
+                       (tegra_vpr_start + tegra_vpr_size) <
+                               TEGRA_ASIM_QT_CARVEOUT_MIN_SIZE)) {
+                       /*
+                        * The tegra ASIM/QT carveout has a min size:-
+                        * TEGRA_ASIM_QT_CARVEOUT_MIN_SIZE. All free regions in
+                        * front door mem are smaller than the min carveout
+                        * size. Therefore, we can't fit the carveout in front
+                        * door mem.
+                        */
+                       BUG();
+               } else if (
+                       (tegra_vpr_start -
+                       (TEGRA_ASIM_QT_FB_START + TEGRA_ASIM_QT_FB_SIZE)) >=
+                       (TEGRA_ASIM_QT_FRONT_DOOR_MEM_START +
+                       TEGRA_ASIM_QT_FRONT_DOOR_MEM_SIZE -
+                       (tegra_vpr_start + tegra_vpr_size))) {
+                       /*
+                        * Place the tegra ASIM/QT carveout between the
+                        * framebuffer and VPR.
+                        */
+                       tegra_carveout_start =
+                               TEGRA_ASIM_QT_CARVEOUT_VPR_DISABLED_START;
+                       tegra_carveout_size = tegra_vpr_start -
+                                               (TEGRA_ASIM_QT_FB_START +
+                                               TEGRA_ASIM_QT_FB_SIZE);
+               } else {
+                       /*
+                        * Place the tegra ASIM/QT carveout after VPR.
+                        */
+                       tegra_carveout_start = tegra_vpr_start + tegra_vpr_size;
+                       tegra_carveout_size =
+                                       TEGRA_ASIM_QT_FRONT_DOOR_MEM_START +
+                                       TEGRA_ASIM_QT_FRONT_DOOR_MEM_SIZE -
+                                       (tegra_vpr_start + tegra_vpr_size);
+               }
+       } else if (tegra_vpr_size != 0) {
+               /*
+                * VPR cannot work on ASIM/ASIM + QT if split mem is not
+                * enabled.
+                */
+               BUG();
        }
 #endif
 
index 2c2c0a9..c9e4f81 100644 (file)
 #endif
 
 #ifdef CONFIG_TEGRA_SIMULATION_SPLIT_MEM
-#define TEGRA_ASIM_QT_FB_START         0x81000000
+#define TEGRA_ASIM_QT_FRONT_DOOR_MEM_START     0x81000000
+#define TEGRA_ASIM_QT_FRONT_DOOR_MEM_SIZE      (SZ_256M - SZ_16M)
+#define TEGRA_ASIM_QT_FB_START         TEGRA_ASIM_QT_FRONT_DOOR_MEM_START
 #define TEGRA_ASIM_QT_FB_SIZE          SZ_4M
-#define TEGRA_ASIM_QT_CARVEOUT_START   0x81400000
-#define TEGRA_ASIM_QT_CARVEOUT_SIZE    (SZ_256M - SZ_16M - SZ_4M)
+#define TEGRA_ASIM_QT_CARVEOUT_VPR_DISABLED_START \
+                               (TEGRA_ASIM_QT_FB_START + TEGRA_ASIM_QT_FB_SIZE)
+#define TEGRA_ASIM_QT_CARVEOUT_VPR_DISABLED_SIZE \
+               (TEGRA_ASIM_QT_FRONT_DOOR_MEM_SIZE - TEGRA_ASIM_QT_FB_SIZE)
+#define TEGRA_ASIM_QT_CARVEOUT_MIN_SIZE                SZ_128M
 #endif
 
 #if defined(CONFIG_ARCH_TEGRA_2x_SOC)  || defined(CONFIG_ARCH_TEGRA_3x_SOC) || \