From f9e3de2a8cabd672cab9dd36626c2527b75e29b5 Mon Sep 17 00:00:00 2001 From: Terry Lv Date: Tue, 16 Aug 2011 16:04:44 +0800 Subject: [PATCH] ENGR00154889-1: Add virtual iim driver to imx5 and imx6 platform This patch adds platform changes to system files, including: 1. Add viim platform deivce. 2. Add viim menu. Signed-off-by: Terry Lv --- arch/arm/configs/imx6_defconfig | 6 ++- arch/arm/mach-mx5/Kconfig | 1 + arch/arm/mach-mx5/board-mx50_rdp.c | 1 + arch/arm/mach-mx5/devices-imx50.h | 4 ++ arch/arm/mach-mx6/Kconfig | 1 + arch/arm/mach-mx6/board-mx6q_sabreauto.c | 1 + arch/arm/mach-mx6/devices-imx6q.h | 6 ++- arch/arm/plat-mxc/devices/Kconfig | 3 ++ arch/arm/plat-mxc/devices/Makefile | 1 + arch/arm/plat-mxc/devices/platform-imx-viim.c | 45 +++++++++++++++++++ .../plat-mxc/include/mach/devices-common.h | 7 +++ 11 files changed, 73 insertions(+), 3 deletions(-) create mode 100644 arch/arm/plat-mxc/devices/platform-imx-viim.c diff --git a/arch/arm/configs/imx6_defconfig b/arch/arm/configs/imx6_defconfig index 3ef30a90b404..7c19d2bc8840 100644 --- a/arch/arm/configs/imx6_defconfig +++ b/arch/arm/configs/imx6_defconfig @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit # Linux/arm 2.6.38 Kernel Configuration -# Wed Jul 27 13:18:10 2011 +# Tue Aug 16 14:53:37 2011 # CONFIG_ARM=y CONFIG_HAVE_PWM=y @@ -270,6 +270,7 @@ CONFIG_IMX_HAVE_PLATFORM_IMX_IPUV3=y CONFIG_IMX_HAVE_PLATFORM_IMX_VPU=y CONFIG_IMX_HAVE_PLATFORM_AHCI=y CONFIG_IMX_HAVE_PLATFORM_IMX_OCOTP=y +CONFIG_IMX_HAVE_PLATFORM_IMX_VIIM=y CONFIG_IMX_HAVE_PLATFORM_LDB=y CONFIG_IMX_HAVE_PLATFORM_VIV_GPU=y CONFIG_IMX_HAVE_PLATFORM_MXC_HDMI=y @@ -290,6 +291,7 @@ CONFIG_IMX_HAVE_PLATFORM_IMX_ASRC=y # CONFIG_ARCH_MX5 is not set CONFIG_ARCH_MX6=y CONFIG_FORCE_MAX_ZONEORDER=13 +CONFIG_DMA_ZONE_SIZE=96 CONFIG_ARCH_MX6Q=y CONFIG_SOC_IMX6Q=y CONFIG_MACH_MX6Q_SABREAUTO=y @@ -303,7 +305,6 @@ CONFIG_MXC_PWM=y # CONFIG_MXC_DEBUG_BOARD is not set CONFIG_ARCH_MXC_IOMUX_V3=y CONFIG_IRAM_ALLOC=y -CONFIG_DMA_ZONE_SIZE=96 CONFIG_CLK_DEBUG=y # @@ -1023,6 +1024,7 @@ CONFIG_HW_RANDOM=y # CONFIG_RAW_DRIVER is not set # CONFIG_TCG_TPM is not set # CONFIG_RAMOOPS is not set +CONFIG_MXS_VIIM=y CONFIG_I2C=y CONFIG_I2C_BOARDINFO=y CONFIG_I2C_COMPAT=y diff --git a/arch/arm/mach-mx5/Kconfig b/arch/arm/mach-mx5/Kconfig index ccb8e7dc46b2..4588dd9b23ec 100755 --- a/arch/arm/mach-mx5/Kconfig +++ b/arch/arm/mach-mx5/Kconfig @@ -76,6 +76,7 @@ config MACH_MX50_RDP select IMX_HAVE_PLATFORM_FEC select IMX_HAVE_PLATFORM_GPMI_NFC select IMX_HAVE_PLATFORM_IMX_OCOTP + select IMX_HAVE_PLATFORM_IMX_VIIM select IMX_HAVE_PLATFORM_IMX_DCP select IMX_HAVE_PLATFORM_RANDOM_RNGC select IMX_HAVE_PLATFORM_PERFMON diff --git a/arch/arm/mach-mx5/board-mx50_rdp.c b/arch/arm/mach-mx5/board-mx50_rdp.c index c3b930922464..8c0064e0c743 100755 --- a/arch/arm/mach-mx5/board-mx50_rdp.c +++ b/arch/arm/mach-mx5/board-mx50_rdp.c @@ -845,6 +845,7 @@ static void __init mx50_rdp_board_init(void) imx50_add_sdhci_esdhc_imx(1, &mx50_rdp_sd2_data); imx50_add_sdhci_esdhc_imx(2, &mx50_rdp_sd3_data); imx50_add_otp(); + imx50_add_viim(); imx50_add_dcp(); imx50_add_rngb(); imx50_add_perfmon(); diff --git a/arch/arm/mach-mx5/devices-imx50.h b/arch/arm/mach-mx5/devices-imx50.h index 0cc376dcb7c5..bdaf32213c21 100755 --- a/arch/arm/mach-mx5/devices-imx50.h +++ b/arch/arm/mach-mx5/devices-imx50.h @@ -61,6 +61,10 @@ extern const struct imx_otp_data imx50_otp_data __initconst; #define imx50_add_otp() \ imx_add_otp(&imx50_otp_data); +extern const struct imx_viim_data imx50_viim_data __initconst; +#define imx50_add_viim() \ + imx_add_viim(&imx50_viim_data) + extern const struct imx_dcp_data imx50_dcp_data __initconst; #define imx50_add_dcp() \ imx_add_dcp(&imx50_dcp_data); diff --git a/arch/arm/mach-mx6/Kconfig b/arch/arm/mach-mx6/Kconfig index 847e6ab0af1b..8d0d3c766046 100644 --- a/arch/arm/mach-mx6/Kconfig +++ b/arch/arm/mach-mx6/Kconfig @@ -40,6 +40,7 @@ config MACH_MX6Q_SABREAUTO select IMX_HAVE_PLATFORM_FSL_USB_WAKEUP select IMX_HAVE_PLATFORM_AHCI select IMX_HAVE_PLATFORM_IMX_OCOTP + select IMX_HAVE_PLATFORM_IMX_VIIM select IMX_HAVE_PLATFORM_IMX2_WDT select IMX_HAVE_PLATFORM_IMX_SNVS_RTC select IMX_HAVE_PLATFORM_IMX_PM diff --git a/arch/arm/mach-mx6/board-mx6q_sabreauto.c b/arch/arm/mach-mx6/board-mx6q_sabreauto.c index 80d769533c04..4eebd2ba728f 100644 --- a/arch/arm/mach-mx6/board-mx6q_sabreauto.c +++ b/arch/arm/mach-mx6/board-mx6q_sabreauto.c @@ -739,6 +739,7 @@ static void __init mx6_board_init(void) gpio_request(MX6Q_SABREAUTO_LDB_BACKLIGHT, "ldb-backlight"); gpio_direction_output(MX6Q_SABREAUTO_LDB_BACKLIGHT, 1); imx6q_add_otp(); + imx6q_add_viim(); imx6q_add_imx2_wdt(0, NULL); imx6q_add_dma(); imx6q_add_gpmi(&mx6q_gpmi_nfc_platform_data); diff --git a/arch/arm/mach-mx6/devices-imx6q.h b/arch/arm/mach-mx6/devices-imx6q.h index 8e790c72f423..c9cf454629f1 100644 --- a/arch/arm/mach-mx6/devices-imx6q.h +++ b/arch/arm/mach-mx6/devices-imx6q.h @@ -117,7 +117,11 @@ extern const struct imx_vpu_data imx6q_vpu_data __initconst; extern const struct imx_otp_data imx6q_otp_data __initconst; #define imx6q_add_otp() \ - imx_add_otp(&imx6q_otp_data); + imx_add_otp(&imx6q_otp_data) + +extern const struct imx_viim_data imx6q_viim_data __initconst; +#define imx6q_add_viim() \ + imx_add_viim(&imx6q_viim_data) extern const struct imx_imx2_wdt_data imx6q_imx2_wdt_data[] __initconst; #define imx6q_add_imx2_wdt(id, pdata) \ diff --git a/arch/arm/plat-mxc/devices/Kconfig b/arch/arm/plat-mxc/devices/Kconfig index b076058a5c49..3be72bcf3568 100755 --- a/arch/arm/plat-mxc/devices/Kconfig +++ b/arch/arm/plat-mxc/devices/Kconfig @@ -116,6 +116,9 @@ config IMX_HAVE_PLATFORM_MXC_GPU config IMX_HAVE_PLATFORM_IMX_OCOTP bool +config IMX_HAVE_PLATFORM_IMX_VIIM + bool + config IMX_HAVE_PLATFORM_IMX_DCP bool diff --git a/arch/arm/plat-mxc/devices/Makefile b/arch/arm/plat-mxc/devices/Makefile index 5073906e2f48..f1bac4b0a7fc 100755 --- a/arch/arm/plat-mxc/devices/Makefile +++ b/arch/arm/plat-mxc/devices/Makefile @@ -37,6 +37,7 @@ obj-$(CONFIG_IMX_HAVE_PLATFORM_AHCI) += platform-ahci-imx.o obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_IIM) += platform-imx-iim.o obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_GPU) += platform-mxc_gpu.o obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_OCOTP) += platform-imx-ocotp.o +obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_VIIM) += platform-imx-viim.o obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_DCP) += platform-imx-dcp.o obj-$(CONFIG_IMX_HAVE_PLATFORM_RANDOM_RNGC) += platform-imx-rngb.o obj-$(CONFIG_IMX_HAVE_PLATFORM_PERFMON) += platform-imx-perfmon.o diff --git a/arch/arm/plat-mxc/devices/platform-imx-viim.c b/arch/arm/plat-mxc/devices/platform-imx-viim.c new file mode 100644 index 000000000000..1abc2acb0fdd --- /dev/null +++ b/arch/arm/plat-mxc/devices/platform-imx-viim.c @@ -0,0 +1,45 @@ +/* + * 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 version 2 as published by the + * Free Software Foundation. + */ +#include +#include +#include + +#ifdef CONFIG_SOC_IMX51 +#define GPT_REG_BASE_ADDR (MX50_GPT1_BASE_ADDR) +const struct imx_viim_data imx50_viim_data = { + .iobase = MX50_OCOTP_CTRL_BASE_ADDR, +}; +#endif + +#ifdef CONFIG_SOC_IMX6Q +#define GPT_REG_BASE_ADDR (GPT_BASE_ADDR) +const struct imx_viim_data imx6q_viim_data = { + .iobase = OCOTP_BASE_ADDR, +}; +#endif + +struct platform_device *__init imx_add_viim( + const struct imx_viim_data *data) +{ + struct resource res[] = { + [0] = { + .start = GPT_REG_BASE_ADDR, + .end = GPT_REG_BASE_ADDR + PAGE_SIZE - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = data->iobase, + .end = data->iobase + PAGE_SIZE - 1, + .flags = IORESOURCE_MEM, + }, + }; + + return imx_add_platform_device("mxs-viim", 0, + res, ARRAY_SIZE(res), NULL, 0); +} + diff --git a/arch/arm/plat-mxc/include/mach/devices-common.h b/arch/arm/plat-mxc/include/mach/devices-common.h index 370e681bf022..0eaddcdc1bc8 100755 --- a/arch/arm/plat-mxc/include/mach/devices-common.h +++ b/arch/arm/plat-mxc/include/mach/devices-common.h @@ -513,6 +513,13 @@ struct imx_otp_data { struct platform_device *__init imx_add_otp( const struct imx_otp_data *data); +struct imx_viim_data { + resource_size_t iobase; +}; + +struct platform_device *__init imx_add_viim( + const struct imx_viim_data *data); + struct imx_dcp_data { resource_size_t iobase; resource_size_t irq1; -- 2.39.5