]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
arm: tegra: update dma linear map table for VPR
authorVandana Salve <vsalve@nvidia.com>
Wed, 6 Nov 2013 18:19:45 +0000 (23:49 +0530)
committerKrishna Reddy <vdumpa@nvidia.com>
Thu, 14 Nov 2013 16:49:15 +0000 (08:49 -0800)
Update the dma linear map table for vpr base and size
with CMA VPR base and size when CMA is used for
VPR carveout

bug 1279160

Change-Id: I38a2c73274a02938d728f4ede4caf8f45aac42c1
Signed-off-by: Vandana Salve <vsalve@nvidia.com>
Reviewed-on: http://git-master/r/327251
Reviewed-by: Krishna Reddy <vdumpa@nvidia.com>
Tested-by: Krishna Reddy <vdumpa@nvidia.com>
arch/arm/mach-tegra/board-ardbeg-panel.c
arch/arm/mach-tegra/board.h
arch/arm/mach-tegra/devices.c

index c2fbebbe018dd1a1ae6781c8f7452ffb55b12875..7b110020941c1753d29a697a2ce0df24745ac6b8 100644 (file)
@@ -589,8 +589,10 @@ int __init ardbeg_panel_init(void)
        ardbeg_carveouts[2].base = tegra_vpr_start;
        ardbeg_carveouts[2].size = tegra_vpr_size;
 #ifdef CONFIG_NVMAP_USE_CMA_FOR_CARVEOUT
+       carveout_linear_set(&tegra_generic_cma_dev);
        ardbeg_carveouts[1].cma_dev = &tegra_generic_cma_dev;
        ardbeg_carveouts[1].resize = false;
+       carveout_linear_set(&tegra_vpr_cma_dev);
        ardbeg_carveouts[2].cma_dev = &tegra_vpr_cma_dev;
        ardbeg_carveouts[2].resize = true;
        ardbeg_carveouts[2].cma_chunk_size = SZ_32M;
index ca5a80d1522611a7612deb506966a851aaa42721..e27d02dc9d07b427541b20ad4d12ac0c3431dd39 100644 (file)
@@ -162,6 +162,12 @@ void tegra_fb_linear_set(struct iommu_linear_map *map);
 static inline void tegra_fb_linear_set(struct iommu_linear_map *map) {}
 #endif
 
+#ifdef CONFIG_NVMAP_USE_CMA_FOR_CARVEOUT
+void carveout_linear_set(struct device *cma_dev);
+#else
+static inline void carveout_linear_set(struct device *cma_dev) {}
+#endif
+
 void tegra_init_late(void);
 
 #ifdef CONFIG_DEBUG_FS
index 0b5530aa591203d2660cb336bc5149e32f3d0c88..40985dd0495f1d35531e381c31a79229572dba48 100644 (file)
@@ -34,6 +34,7 @@
 #include <linux/usb/tegra_usb_phy.h>
 #include <mach/tegra_smmu.h>
 #include <mach/tegra-swgid.h>
+#include <linux/dma-contiguous.h>
 
 #ifdef CONFIG_TEGRA_WAKEUP_MONITOR
 #include <mach/tegra_wakeup_monitor.h>
@@ -2152,9 +2153,28 @@ void tegra_fb_linear_set(struct iommu_linear_map *map)
        LINEAR_MAP_ADD(tegra_fb2);
        LINEAR_MAP_ADD(tegra_bootloader_fb);
        LINEAR_MAP_ADD(tegra_bootloader_fb2);
+#ifndef CONFIG_NVMAP_USE_CMA_FOR_CARVEOUT
        LINEAR_MAP_ADD(tegra_vpr);
        LINEAR_MAP_ADD(tegra_carveout);
+#endif
+}
+
+#ifdef CONFIG_NVMAP_USE_CMA_FOR_CARVEOUT
+void carveout_linear_set(struct device *cma_dev)
+{
+       struct dma_contiguous_stats stats;
+       struct iommu_linear_map *map = &tegra_fb_linear_map[0];
+
+       if (dma_get_contiguous_stats(cma_dev, &stats))
+               return;
+
+       /* get the free slot at end and add carveout entry */
+       while (map && map->size)
+               map++;
+       map->start = stats.base;
+       map->size = stats.size;
 }
+#endif
 
 struct swgid_fixup {
        const char * const name;