diff options
author | Richard Zhao <richard.zhao@linaro.org> | 2011-09-02 16:48:25 +0800 |
---|---|---|
committer | Eric Miao <eric.miao@linaro.org> | 2011-11-10 11:17:19 +0800 |
commit | de12b85448f063cd3bfb8959866add6ccb5f25aa (patch) | |
tree | 86b3587297b9d11c5781315e70a8603f410c414e | |
parent | aa96428254309fcb3ba5a100d517f1a17d4c1209 (diff) |
mx53_loco: add amd_gpu device
Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
-rw-r--r-- | arch/arm/mach-mx5/Kconfig | 1 | ||||
-rw-r--r-- | arch/arm/mach-mx5/board-mx53_loco.c | 25 | ||||
-rw-r--r-- | arch/arm/mach-mx5/devices-imx53.h | 4 | ||||
-rw-r--r-- | arch/arm/plat-mxc/devices/Kconfig | 3 | ||||
-rw-r--r-- | arch/arm/plat-mxc/devices/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/plat-mxc/devices/platform-mxc_gpu.c | 103 | ||||
-rw-r--r-- | arch/arm/plat-mxc/include/mach/devices-common.h | 24 | ||||
-rw-r--r-- | arch/arm/plat-mxc/include/mach/mxc_gpu.h | 24 |
8 files changed, 185 insertions, 0 deletions
diff --git a/arch/arm/mach-mx5/Kconfig b/arch/arm/mach-mx5/Kconfig index 7958b623c37..e5ed12d1861 100644 --- a/arch/arm/mach-mx5/Kconfig +++ b/arch/arm/mach-mx5/Kconfig @@ -235,6 +235,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 c6dffee6bd4..805092e1ebc 100644 --- a/arch/arm/mach-mx5/board-mx53_loco.c +++ b/arch/arm/mach-mx5/board-mx53_loco.c @@ -26,6 +26,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> @@ -346,6 +347,10 @@ static struct i2c_board_info mx53loco_i2c_devices[] = { }, }; +static struct mxc_gpu_platform_data gpu_data __initdata = { + .reserved_mem_size = SZ_64M, +}; + static void mxc_iim_enable_fuse(void) { u32 reg; @@ -486,6 +491,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) @@ -497,6 +509,18 @@ static struct sys_timer mx53_loco_timer = { .init = mx53_loco_timer_init, }; +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, @@ -504,4 +528,5 @@ MACHINE_START(MX53_LOCO, "Freescale MX53 LOCO Board") .handle_irq = imx53_handle_irq, .timer = &mx53_loco_timer, .init_machine = mx53_loco_board_init, + .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 75c489fec95..a7851882b1b 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 c02d6f7fa16..3372ab2774c 100644 --- a/arch/arm/plat-mxc/devices/Kconfig +++ b/arch/arm/plat-mxc/devices/Kconfig @@ -67,6 +67,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 cadbc752ddb..b81b831721c 100644 --- a/arch/arm/plat-mxc/devices/Makefile +++ b/arch/arm/plat-mxc/devices/Makefile @@ -23,6 +23,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 ed7133b607e..a66920e887f 100644 --- a/arch/arm/plat-mxc/include/mach/devices-common.h +++ b/arch/arm/plat-mxc/include/mach/devices-common.h @@ -378,3 +378,27 @@ struct imx_iim_data { struct platform_device *__init imx_add_iim( const struct imx_iim_data *data, const struct mxc_iim_platform_data *pdata); + +#include <linux/ahci_platform.h> +struct imx_ahci_imx_data { + const char *devid; + resource_size_t iobase; + resource_size_t irq; +}; +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_ */ |