aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Zhao <richard.zhao@linaro.org>2011-09-02 16:48:01 +0800
committerBernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>2011-09-09 20:54:49 +0159
commitc19c18d7a6d210e4e184530b61ac78947b6ae20a (patch)
tree0e8f58f9dea59c85fab6ec1ebae751aedc351007
parent7096f4f98ba026c9fd20281a077fab6b6b31b589 (diff)
downloadimx53-c19c18d7a6d210e4e184530b61ac78947b6ae20a.tar.gz
Backport from Landing Team 3.1-rc3:
mx53_loco: add amd_gpu device Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
-rw-r--r--arch/arm/mach-mx5/Kconfig1
-rw-r--r--arch/arm/mach-mx5/board-mx53_loco.c26
-rw-r--r--arch/arm/mach-mx5/devices-imx53.h4
-rw-r--r--arch/arm/plat-mxc/devices/Kconfig3
-rw-r--r--arch/arm/plat-mxc/devices/Makefile1
-rw-r--r--arch/arm/plat-mxc/devices/platform-mxc_gpu.c103
-rw-r--r--arch/arm/plat-mxc/include/mach/devices-common.h14
-rw-r--r--arch/arm/plat-mxc/include/mach/mxc_gpu.h24
8 files changed, 176 insertions, 0 deletions
diff --git a/arch/arm/mach-mx5/Kconfig b/arch/arm/mach-mx5/Kconfig
index cc9639012ef..de72f993cd4 100644
--- a/arch/arm/mach-mx5/Kconfig
+++ b/arch/arm/mach-mx5/Kconfig
@@ -208,6 +208,7 @@ config MACH_MX53_LOCO
select IMX_HAVE_PLATFORM_IMX_I2C
select IMX_HAVE_PLATFORM_IMX_SRTC
select IMX_HAVE_PLATFORM_IMX_UART
+ select IMX_HAVE_PLATFORM_MXC_GPU
select IMX_HAVE_PLATFORM_MXC_PWM
select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX
select IMX_HAVE_PLATFORM_GPIO_KEYS
diff --git a/arch/arm/mach-mx5/board-mx53_loco.c b/arch/arm/mach-mx5/board-mx53_loco.c
index 0ee8c7371b7..ea78615a7b3 100644
--- a/arch/arm/mach-mx5/board-mx53_loco.c
+++ b/arch/arm/mach-mx5/board-mx53_loco.c
@@ -25,6 +25,7 @@
#include <linux/fsl_devices.h>
#include <linux/ipu.h>
#include <linux/pwm_backlight.h>
+#include <linux/memblock.h>
#include <mach/common.h>
#include <mach/hardware.h>
@@ -313,6 +314,10 @@ static const struct gpio_led_platform_data mx53loco_leds_data __initconst = {
.num_leds = ARRAY_SIZE(mx53loco_leds),
};
+static struct mxc_gpu_platform_data gpu_data __initdata = {
+ .reserved_mem_size = SZ_64M,
+};
+
static void mxc_iim_enable_fuse(void)
{
u32 reg;
@@ -445,6 +450,13 @@ static void __init mx53_loco_board_init(void)
imx53_add_mxc_pwm(1);
imx53_add_mxc_pwm_backlight(0, &loco_pwm_backlight_data);
+
+ /*GPU*/
+ if (mx53_revision() >= IMX_CHIP_REVISION_2_0)
+ gpu_data.z160_revision = 1;
+ else
+ gpu_data.z160_revision = 0;
+ imx53_add_mxc_gpu(&gpu_data);
}
static void __init mx53_loco_timer_init(void)
@@ -460,6 +472,19 @@ static const char *mx53_loco_dt_match[] __initdata = {
"fsl,mx53-loco",
NULL
};
+
+static void __init mx53_loco_reserve(void)
+{
+ phys_addr_t phys;
+
+ if (gpu_data.reserved_mem_size) {
+ phys = memblock_alloc(gpu_data.reserved_mem_size, SZ_4K);
+ memblock_free(phys, gpu_data.reserved_mem_size);
+ memblock_remove(phys, gpu_data.reserved_mem_size);
+ gpu_data.reserved_mem_base = phys;
+ }
+}
+
MACHINE_START(MX53_LOCO, "Freescale MX53 LOCO Board")
.map_io = mx53_map_io,
.init_early = imx53_init_early,
@@ -467,4 +492,5 @@ MACHINE_START(MX53_LOCO, "Freescale MX53 LOCO Board")
.timer = &mx53_loco_timer,
.init_machine = mx53_loco_board_init,
.dt_compat = mx53_loco_dt_match,
+ .reserve = mx53_loco_reserve,
MACHINE_END
diff --git a/arch/arm/mach-mx5/devices-imx53.h b/arch/arm/mach-mx5/devices-imx53.h
index aab48b05d93..192552f6838 100644
--- a/arch/arm/mach-mx5/devices-imx53.h
+++ b/arch/arm/mach-mx5/devices-imx53.h
@@ -29,6 +29,10 @@ extern const struct imx_spi_imx_data imx53_ecspi_data[];
#define imx53_add_ecspi(id, pdata) \
imx_add_spi_imx(&imx53_ecspi_data[id], pdata)
+extern const struct imx_mxc_gpu_data imx53_gpu_data __initconst;
+#define imx53_add_mxc_gpu(pdata) \
+ imx_add_mxc_gpu(&imx53_gpu_data, pdata)
+
extern const struct imx_imx2_wdt_data imx53_imx2_wdt_data[];
#define imx53_add_imx2_wdt(id, pdata) \
imx_add_imx2_wdt(&imx53_imx2_wdt_data[id])
diff --git a/arch/arm/plat-mxc/devices/Kconfig b/arch/arm/plat-mxc/devices/Kconfig
index c1051ac8038..7d769560e3b 100644
--- a/arch/arm/plat-mxc/devices/Kconfig
+++ b/arch/arm/plat-mxc/devices/Kconfig
@@ -64,6 +64,9 @@ config IMX_HAVE_PLATFORM_MX2_CAMERA
config IMX_HAVE_PLATFORM_MXC_EHCI
bool
+config IMX_HAVE_PLATFORM_MXC_GPU
+ bool
+
config IMX_HAVE_PLATFORM_MXC_MMC
bool
diff --git a/arch/arm/plat-mxc/devices/Makefile b/arch/arm/plat-mxc/devices/Makefile
index 3372fcaa354..08b7c6744b3 100644
--- a/arch/arm/plat-mxc/devices/Makefile
+++ b/arch/arm/plat-mxc/devices/Makefile
@@ -21,6 +21,7 @@ obj-$(CONFIG_IMX_HAVE_PLATFORM_LDB) += platform-imx_ldb.o
obj-$(CONFIG_IMX_HAVE_PLATFORM_MX1_CAMERA) += platform-mx1-camera.o
obj-$(CONFIG_IMX_HAVE_PLATFORM_MX2_CAMERA) += platform-mx2-camera.o
obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_EHCI) += platform-mxc-ehci.o
+obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_GPU) += platform-mxc_gpu.o
obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_MMC) += platform-mxc-mmc.o
obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_NAND) += platform-mxc_nand.o
obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_PWM) += platform-mxc_pwm.o
diff --git a/arch/arm/plat-mxc/devices/platform-mxc_gpu.c b/arch/arm/plat-mxc/devices/platform-mxc_gpu.c
new file mode 100644
index 00000000000..6b0b48b0197
--- /dev/null
+++ b/arch/arm/plat-mxc/devices/platform-mxc_gpu.c
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2011 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.
+ */
+
+#include <linux/dma-mapping.h>
+
+#include <asm/sizes.h>
+#include <mach/hardware.h>
+#include <mach/devices-common.h>
+
+#define imx_mxc_gpu_entry_3d_2d(soc) \
+ { \
+ .irq_3d = soc ## _INT_GPU, \
+ .irq_2d = soc ## _INT_GPU2_IRQ, \
+ .iobase_3d = soc ## _GPU_BASE_ADDR, \
+ .iobase_2d = soc ## _GPU2D_BASE_ADDR, \
+ .gmem_base = soc ## _GPU_GMEM_BASE_ADDR, \
+ .gmem_size = soc ## _GPU_GMEM_SIZE, \
+ }
+
+#define imx_mxc_gpu_entry_2d(soc) \
+ { \
+ .irq_2d = soc ## _INT_GPU2_IRQ, \
+ .iobase_2d = soc ## _GPU2D_BASE_ADDR, \
+ }
+
+#ifdef CONFIG_SOC_IMX35
+const struct imx_mxc_gpu_data imx35_gpu_data __initconst =
+ imx_mxc_gpu_entry_2d(MX35);
+#endif
+
+#ifdef CONFIG_SOC_IMX50
+const struct imx_mxc_gpu_data imx50_gpu_data __initconst =
+ imx_mxc_gpu_entry_2d(MX50);
+#endif
+
+#ifdef CONFIG_SOC_IMX51
+const struct imx_mxc_gpu_data imx51_gpu_data __initconst =
+ imx_mxc_gpu_entry_3d_2d(MX51);
+#endif
+
+#ifdef CONFIG_SOC_IMX53
+const struct imx_mxc_gpu_data imx53_gpu_data __initconst =
+ imx_mxc_gpu_entry_3d_2d(MX53);
+#endif
+
+struct platform_device *__init imx_add_mxc_gpu(
+ const struct imx_mxc_gpu_data *data,
+ const struct mxc_gpu_platform_data *pdata)
+{
+ struct resource res[] = {
+ {
+ .start = data->irq_2d,
+ .end = data->irq_2d,
+ .name = "gpu_2d_irq",
+ .flags = IORESOURCE_IRQ,
+ },
+ {
+ .start = data->irq_3d,
+ .end = data->irq_3d,
+ .name = "gpu_3d_irq",
+ .flags = IORESOURCE_IRQ,
+ },
+ {
+ .start = data->iobase_2d,
+ .end = data->iobase_2d + SZ_4K - 1,
+ .name = "gpu_2d_registers",
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = data->iobase_3d,
+ .end = data->iobase_3d + SZ_128K - 1,
+ .name = "gpu_3d_registers",
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = data->gmem_base,
+ .end = data->gmem_base + data->gmem_size - 1,
+ .name = "gpu_graphics_mem",
+ .flags = IORESOURCE_MEM,
+ },
+ };
+
+ return imx_add_platform_device_dmamask("mxc_gpu", 0,
+ res, ARRAY_SIZE(res),
+ pdata, sizeof(*pdata), DMA_BIT_MASK(32));
+}
diff --git a/arch/arm/plat-mxc/include/mach/devices-common.h b/arch/arm/plat-mxc/include/mach/devices-common.h
index d1866115726..e82221415d9 100644
--- a/arch/arm/plat-mxc/include/mach/devices-common.h
+++ b/arch/arm/plat-mxc/include/mach/devices-common.h
@@ -352,3 +352,17 @@ struct imx_ahci_imx_data {
struct platform_device *__init imx_add_ahci_imx(
const struct imx_ahci_imx_data *data,
const struct ahci_platform_data *pdata);
+
+#include <mach/mxc_gpu.h>
+struct imx_mxc_gpu_data {
+ resource_size_t irq_2d;
+ resource_size_t irq_3d;
+ resource_size_t iobase_2d;
+ resource_size_t iobase_3d;
+ resource_size_t gmem_base;
+ resource_size_t gmem_size;
+};
+
+struct platform_device *__init imx_add_mxc_gpu(
+ const struct imx_mxc_gpu_data *data,
+ const struct mxc_gpu_platform_data *pdata);
diff --git a/arch/arm/plat-mxc/include/mach/mxc_gpu.h b/arch/arm/plat-mxc/include/mach/mxc_gpu.h
new file mode 100644
index 00000000000..a43d6ec99bf
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/mxc_gpu.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2011 Freescale Semiconductor, Inc.
+ *
+ * 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.
+ */
+
+#ifndef __MACH_MXC_GPU_H_
+#define __MACH_MXC_GPU_H_
+
+struct mxc_gpu_platform_data {
+ int z160_revision;
+ resource_size_t reserved_mem_base;
+ resource_size_t reserved_mem_size;
+};
+
+#endif /* __MACH_MXC_GPU_H_ */