summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorXinyu Chen <xinyu.chen@freescale.com>2012-04-26 11:00:19 +0800
committerXinyu Chen <xinyu.chen@freescale.com>2012-04-26 13:32:33 +0800
commit5463f103cf6a23876e3c3969ee0602b23ae50475 (patch)
tree78acb45d3ea3b6b4833eb7a0d6387226b89b28f4 /arch
parent698e761daab207dcfd40dffdf43b82f0fded9d7d (diff)
ENGR00180865-3 mx6: Add imx ion allocator device support
Remove the pmem device define. Add ion allocator device support and memory reservation. Signed-off-by: Xinyu Chen <xinyu.chen@freescale.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-mx6/android.h25
-rw-r--r--arch/arm/mach-mx6/board-mx6q_arm2.c61
-rw-r--r--arch/arm/mach-mx6/board-mx6q_sabreauto.c60
-rw-r--r--arch/arm/mach-mx6/board-mx6q_sabrelite.c55
-rw-r--r--arch/arm/mach-mx6/board-mx6q_sabresd.c38
-rw-r--r--arch/arm/mach-mx6/devices-imx6q.h3
-rw-r--r--arch/arm/mach-mx6/devices.c10
7 files changed, 72 insertions, 180 deletions
diff --git a/arch/arm/mach-mx6/android.h b/arch/arm/mach-mx6/android.h
deleted file mode 100644
index 5ee01f10a5ce..000000000000
--- a/arch/arm/mach-mx6/android.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (C) 2012 Freescale Semiconductor, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef ANDROID_H
-#define ANDROID_H
-
-extern struct platform_device mxc_android_pmem_device;
-extern struct platform_device mxc_android_pmem_gpu_device;
-
-#endif
diff --git a/arch/arm/mach-mx6/board-mx6q_arm2.c b/arch/arm/mach-mx6/board-mx6q_arm2.c
index ca04938126f8..ba8f92fedfdd 100644
--- a/arch/arm/mach-mx6/board-mx6q_arm2.c
+++ b/arch/arm/mach-mx6/board-mx6q_arm2.c
@@ -45,7 +45,7 @@
#include <linux/fec.h>
#include <linux/memblock.h>
#include <linux/gpio.h>
-#include <linux/android_pmem.h>
+#include <linux/ion.h>
#include <linux/etherdevice.h>
#include <linux/regulator/anatop-regulator.h>
#include <linux/regulator/consumer.h>
@@ -77,7 +77,6 @@
#include "devices-imx6q.h"
#include "crm_regs.h"
#include "cpu_op-mx6.h"
-#include "android.h"
#include "board-mx6q_arm2.h"
#include "board-mx6dl_arm2.h"
@@ -1482,14 +1481,15 @@ static struct platform_pwm_backlight_data mx6_arm2_pwm_backlight_data = {
.pwm_period_ns = 50000,
};
-static struct android_pmem_platform_data android_pmem_data = {
- .name = "pmem_adsp",
- .size = SZ_64M,
-};
-
-static struct android_pmem_platform_data android_pmem_gpu_data = {
- .name = "pmem_gpu",
- .size = SZ_32M,
+static struct ion_platform_data imx_ion_data = {
+ .nr = 1,
+ .heaps = {
+ {
+ .type = ION_HEAP_TYPE_CARVEOUT,
+ .name = "vpu_ion",
+ .size = SZ_64M,
+ },
+ },
};
static struct gpio mx6_flexcan_gpios[] = {
@@ -1892,25 +1892,6 @@ static struct mxc_dvfs_platform_data arm2_dvfscore_data = {
static void __init mx6_arm2_fixup(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi)
{
- char *str;
- struct tag *t;
-
- for_each_tag(t, tags) {
- if (t->hdr.tag == ATAG_CMDLINE) {
- str = t->u.cmdline.cmdline;
- str = strstr(str, "pmem=");
- if (str != NULL) {
- str += 5;
- android_pmem_gpu_data.size = memparse(str, &str);
- if (*str == ',') {
- str++;
- android_pmem_data.size = memparse(str, &str);
- }
- }
-
- break;
- }
- }
}
static int __init early_enable_sgtl5000(char *p)
@@ -2177,9 +2158,8 @@ static void __init mx6_arm2_init(void)
imx6q_add_dvfs_core(&arm2_dvfscore_data);
- mxc_register_device(&mxc_android_pmem_device, &android_pmem_data);
- mxc_register_device(&mxc_android_pmem_gpu_device,
- &android_pmem_gpu_data);
+ imx6q_add_ion(0, &imx_ion_data,
+ sizeof(imx_ion_data) + sizeof(struct ion_platform_heap));
imx6q_add_mxc_pwm(0);
imx6q_add_mxc_pwm_backlight(0, &mx6_arm2_pwm_backlight_data);
@@ -2248,18 +2228,11 @@ static void __init mx6_arm2_reserve(void)
imx6_gpu_pdata.reserved_mem_base = phys;
}
- if (android_pmem_data.size) {
- phys = memblock_alloc(android_pmem_data.size, SZ_4K);
- memblock_free(phys, android_pmem_data.size);
- memblock_remove(phys, android_pmem_data.size);
- android_pmem_data.start = phys;
- }
-
- if (android_pmem_gpu_data.size) {
- phys = memblock_alloc(android_pmem_gpu_data.size, SZ_4K);
- memblock_free(phys, android_pmem_gpu_data.size);
- memblock_remove(phys, android_pmem_gpu_data.size);
- android_pmem_gpu_data.start = phys;
+ if (imx_ion_data.heaps[0].size) {
+ phys = memblock_alloc(imx_ion_data.heaps[0].size, SZ_4K);
+ memblock_free(phys, imx_ion_data.heaps[0].size);
+ memblock_remove(phys, imx_ion_data.heaps[0].size);
+ imx_ion_data.heaps[0].base = phys;
}
}
diff --git a/arch/arm/mach-mx6/board-mx6q_sabreauto.c b/arch/arm/mach-mx6/board-mx6q_sabreauto.c
index 273a55ab27e6..571ae7ce03f2 100644
--- a/arch/arm/mach-mx6/board-mx6q_sabreauto.c
+++ b/arch/arm/mach-mx6/board-mx6q_sabreauto.c
@@ -49,12 +49,12 @@
#include <linux/fec.h>
#include <linux/memblock.h>
#include <linux/gpio.h>
+#include <linux/ion.h>
#include <linux/etherdevice.h>
#include <linux/regulator/anatop-regulator.h>
#include <linux/regulator/consumer.h>
#include <linux/regulator/machine.h>
#include <linux/regulator/fixed.h>
-#include <linux/android_pmem.h>
#include <sound/pcm.h>
#include <mach/common.h>
@@ -81,7 +81,6 @@
#include "devices-imx6q.h"
#include "crm_regs.h"
#include "cpu_op-mx6.h"
-#include "android.h"
#include "board-mx6q_sabreauto.h"
#include "board-mx6solo_sabreauto.h"
@@ -931,14 +930,15 @@ static struct platform_pwm_backlight_data mx6_arm2_pwm_backlight_data3 = {
.pwm_period_ns = 50000,
};
-static struct android_pmem_platform_data android_pmem_data = {
- .name = "pmem_adsp",
- .size = SZ_64M,
-};
-
-static struct android_pmem_platform_data android_pmem_gpu_data = {
- .name = "pmem_gpu",
- .size = SZ_32M,
+static struct ion_platform_data imx_ion_data = {
+ .nr = 1,
+ .heaps = {
+ {
+ .type = ION_HEAP_TYPE_CARVEOUT,
+ .name = "vpu_ion",
+ .size = SZ_64M,
+ },
+ },
};
/* Backlight PWM for Main board lvds*/
@@ -1230,25 +1230,6 @@ static struct mxc_dvfs_platform_data sabreauto_dvfscore_data = {
static void __init fixup_mxc_board(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi)
{
- char *str;
- struct tag *t;
-
- for_each_tag(t, tags) {
- if (t->hdr.tag == ATAG_CMDLINE) {
- str = t->u.cmdline.cmdline;
- str = strstr(str, "pmem=");
- if (str != NULL) {
- str += 5;
- android_pmem_gpu_data.size = memparse(str, &str);
- if (*str == ',') {
- str++;
- android_pmem_data.size = memparse(str, &str);
- }
- }
-
- break;
- }
- }
}
static int __init early_enable_mipi_sensor(char *p)
@@ -1505,9 +1486,8 @@ static void __init mx6_board_init(void)
imx6q_add_dvfs_core(&sabreauto_dvfscore_data);
- mxc_register_device(&mxc_android_pmem_device, &android_pmem_data);
- mxc_register_device(&mxc_android_pmem_gpu_device,
- &android_pmem_gpu_data);
+ imx6q_add_ion(0, &imx_ion_data,
+ sizeof(imx_ion_data) + sizeof(struct ion_platform_heap));
imx6q_add_mxc_pwm(2);
imx6q_add_mxc_pwm(3);
imx6q_add_mxc_pwm_backlight(2, &mx6_arm2_pwm_backlight_data3);
@@ -1563,18 +1543,12 @@ static void __init mx6q_reserve(void)
memblock_remove(phys, imx6q_gpu_pdata.reserved_mem_size);
imx6q_gpu_pdata.reserved_mem_base = phys;
}
- if (android_pmem_data.size) {
- phys = memblock_alloc(android_pmem_data.size, SZ_4K);
- memblock_free(phys, android_pmem_data.size);
- memblock_remove(phys, android_pmem_data.size);
- android_pmem_data.start = phys;
- }
- if (android_pmem_gpu_data.size) {
- phys = memblock_alloc(android_pmem_gpu_data.size, SZ_4K);
- memblock_free(phys, android_pmem_gpu_data.size);
- memblock_remove(phys, android_pmem_gpu_data.size);
- android_pmem_gpu_data.start = phys;
+ if (imx_ion_data.heaps[0].size) {
+ phys = memblock_alloc(imx_ion_data.heaps[0].size, SZ_4K);
+ memblock_free(phys, imx_ion_data.heaps[0].size);
+ memblock_remove(phys, imx_ion_data.heaps[0].size);
+ imx_ion_data.heaps[0].base = phys;
}
}
diff --git a/arch/arm/mach-mx6/board-mx6q_sabrelite.c b/arch/arm/mach-mx6/board-mx6q_sabrelite.c
index e00994f6fad8..ce10d6d6a8fb 100644
--- a/arch/arm/mach-mx6/board-mx6q_sabrelite.c
+++ b/arch/arm/mach-mx6/board-mx6q_sabrelite.c
@@ -45,12 +45,12 @@
#include <linux/fec.h>
#include <linux/memblock.h>
#include <linux/gpio.h>
+#include <linux/ion.h>
#include <linux/etherdevice.h>
#include <linux/regulator/anatop-regulator.h>
#include <linux/regulator/consumer.h>
#include <linux/regulator/machine.h>
#include <linux/regulator/fixed.h>
-#include <linux/android_pmem.h>
#include <mach/common.h>
#include <mach/hardware.h>
@@ -71,7 +71,6 @@
#include <asm/mach/time.h>
#include "usb.h"
-#include "android.h"
#include "devices-imx6q.h"
#include "crm_regs.h"
#include "cpu_op-mx6.h"
@@ -833,14 +832,15 @@ static struct imx_ipuv3_platform_data ipu_data[] = {
},
};
-static struct android_pmem_platform_data android_pmem_data = {
- .name = "pmem_adsp",
- .size = SZ_64M,
-};
-
-static struct android_pmem_platform_data android_pmem_gpu_data = {
- .name = "pmem_gpu",
- .size = SZ_32M,
+static struct ion_platform_data imx_ion_data = {
+ .nr = 1,
+ .heaps = {
+ {
+ .type = ION_HEAP_TYPE_CARVEOUT,
+ .name = "vpu_ion",
+ .size = SZ_64M,
+ },
+ },
};
static void sabrelite_suspend_enter(void)
@@ -1058,17 +1058,6 @@ static void __init fixup_mxc_board(struct machine_desc *desc, struct tag *tags,
for_each_tag(t, tags) {
if (t->hdr.tag == ATAG_CMDLINE) {
str = t->u.cmdline.cmdline;
- str = strstr(str, "pmem=");
- if (str != NULL) {
- str += 5;
- android_pmem_gpu_data.size = memparse(str, &str);
- if (*str == ',') {
- str++;
- android_pmem_data.size = memparse(str, &str);
- }
- }
-
- str = t->u.cmdline.cmdline;
str = strstr(str, "fbmem=");
if (str != NULL) {
str += 6;
@@ -1182,9 +1171,8 @@ static void __init mx6_sabrelite_board_init(void)
imx6q_add_dvfs_core(&sabrelite_dvfscore_data);
mx6_cpu_regulator_init();
- mxc_register_device(&mxc_android_pmem_device, &android_pmem_data);
- mxc_register_device(&mxc_android_pmem_gpu_device,
- &android_pmem_gpu_data);
+ imx6q_add_ion(0, &imx_ion_data,
+ sizeof(imx_ion_data) + sizeof(struct ion_platform_heap));
sabrelite_add_device_buttons();
@@ -1244,22 +1232,13 @@ static void __init mx6q_sabrelite_reserve(void)
imx6q_gpu_pdata.reserved_mem_base = phys;
}
-#ifdef CONFIG_ANDROID_PMEM
- if (android_pmem_data.size) {
- phys = memblock_alloc(android_pmem_data.size, SZ_4K);
- memblock_free(phys, android_pmem_data.size);
- memblock_remove(phys, android_pmem_data.size);
- android_pmem_data.start = phys;
+ if (imx_ion_data.heaps[0].size) {
+ phys = memblock_alloc(imx_ion_data.heaps[0].size, SZ_4K);
+ memblock_free(phys, imx_ion_data.heaps[0].size);
+ memblock_remove(phys, imx_ion_data.heaps[0].size);
+ imx_ion_data.heaps[0].base = phys;
}
- if (android_pmem_gpu_data.size) {
- phys = memblock_alloc(android_pmem_gpu_data.size, SZ_4K);
- memblock_free(phys, android_pmem_gpu_data.size);
- memblock_remove(phys, android_pmem_gpu_data.size);
- android_pmem_gpu_data.start = phys;
- }
-#endif
-
for (i = 0; i < ARRAY_SIZE(sabrelite_fb_data); i++)
if (sabrelite_fb_data[i].res_size[0]) {
/* reserve for background buffer */
diff --git a/arch/arm/mach-mx6/board-mx6q_sabresd.c b/arch/arm/mach-mx6/board-mx6q_sabresd.c
index 8abd5e4ad5fd..10831c014cf7 100644
--- a/arch/arm/mach-mx6/board-mx6q_sabresd.c
+++ b/arch/arm/mach-mx6/board-mx6q_sabresd.c
@@ -45,13 +45,13 @@
#include <linux/fec.h>
#include <linux/memblock.h>
#include <linux/gpio.h>
+#include <linux/ion.h>
#include <linux/etherdevice.h>
#include <linux/power/max8903_charger.h>
#include <linux/regulator/anatop-regulator.h>
#include <linux/regulator/consumer.h>
#include <linux/regulator/machine.h>
#include <linux/regulator/fixed.h>
-#include <linux/android_pmem.h>
#include <linux/mfd/max17135.h>
#include <linux/mfd/wm8994/pdata.h>
#include <linux/mfd/wm8994/gpio.h>
@@ -77,7 +77,6 @@
#include <asm/mach/time.h>
#include "usb.h"
-#include "android.h"
#include "devices-imx6q.h"
#include "crm_regs.h"
#include "cpu_op-mx6.h"
@@ -1277,9 +1276,16 @@ static struct imx_ipuv3_platform_data ipu_data[] = {
},
};
-static struct android_pmem_platform_data android_pmem_data = {
- .name = "pmem_adsp",
- .size = SZ_64M,
+static struct ion_platform_data imx_ion_data = {
+ .nr = 1,
+ .heaps = {
+ {
+ .id = 0,
+ .type = ION_HEAP_TYPE_CARVEOUT,
+ .name = "vpu_ion",
+ .size = SZ_64M,
+ },
+ },
};
static void sabresd_suspend_enter(void)
@@ -1455,13 +1461,6 @@ static void __init fixup_mxc_board(struct machine_desc *desc, struct tag *tags,
for_each_tag(t, tags) {
if (t->hdr.tag == ATAG_CMDLINE) {
str = t->u.cmdline.cmdline;
- str = strstr(str, "pmem=");
- if (str != NULL) {
- str += 5;
- android_pmem_data.size = memparse(str, &str);
- }
-
- str = t->u.cmdline.cmdline;
str = strstr(str, "fbmem=");
if (str != NULL) {
str += 6;
@@ -1651,7 +1650,8 @@ static void __init mx6_sabresd_board_init(void)
imx6q_add_dvfs_core(&sabresd_dvfscore_data);
mx6_cpu_regulator_init();
- mxc_register_device(&mxc_android_pmem_device, &android_pmem_data);
+ imx6q_add_ion(0, &imx_ion_data,
+ sizeof(imx_ion_data) + sizeof(struct ion_platform_heap));
imx6q_add_device_buttons();
/* enable sensor 3v3 and 1v8 */
@@ -1745,14 +1745,12 @@ static void __init mx6q_sabresd_reserve(void)
imx6q_gpu_pdata.reserved_mem_base = phys;
}
-#ifdef CONFIG_ANDROID_PMEM
- if (android_pmem_data.size) {
- phys = memblock_alloc(android_pmem_data.size, SZ_4K);
- memblock_free(phys, android_pmem_data.size);
- memblock_remove(phys, android_pmem_data.size);
- android_pmem_data.start = phys;
+ if (imx_ion_data.heaps[0].size) {
+ phys = memblock_alloc(imx_ion_data.heaps[0].size, SZ_4K);
+ memblock_free(phys, imx_ion_data.heaps[0].size);
+ memblock_remove(phys, imx_ion_data.heaps[0].size);
+ imx_ion_data.heaps[0].base = phys;
}
-#endif
for (i = 0; i < ARRAY_SIZE(sabresd_fb_data); i++)
if (sabresd_fb_data[i].res_size[0]) {
diff --git a/arch/arm/mach-mx6/devices-imx6q.h b/arch/arm/mach-mx6/devices-imx6q.h
index 2c3e0c53ac06..69b2ad2e5500 100644
--- a/arch/arm/mach-mx6/devices-imx6q.h
+++ b/arch/arm/mach-mx6/devices-imx6q.h
@@ -216,3 +216,6 @@ extern const struct imx_pcie_data imx6q_pcie_data __initconst;
#define imx6q_add_busfreq(pdata) imx_add_busfreq(pdata)
+#define imx6q_add_ion(id, pdata, size) \
+ platform_device_register_resndata(NULL, "ion-mxc",\
+ id, NULL, 0, pdata, size);
diff --git a/arch/arm/mach-mx6/devices.c b/arch/arm/mach-mx6/devices.c
index ee7dfbf46ae4..29becab0d430 100644
--- a/arch/arm/mach-mx6/devices.c
+++ b/arch/arm/mach-mx6/devices.c
@@ -32,16 +32,6 @@
#include <mach/hardware.h>
#include <mach/gpio.h>
-struct platform_device mxc_android_pmem_device = {
- .name = "android_pmem",
- .id = 0,
-};
-
-struct platform_device mxc_android_pmem_gpu_device = {
- .name = "android_pmem",
- .id = 1,
-};
-
static struct mxc_gpio_port mxc_gpio_ports[] = {
{
.chip.label = "gpio-0",