From patchwork Tue Nov 22 12:01:55 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martin X-Patchwork-Id: 127069 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:4978:20e::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 4833B1007D1 for ; Tue, 22 Nov 2011 23:05:30 +1100 (EST) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1RSp3Z-0003lC-9H; Tue, 22 Nov 2011 12:02:33 +0000 Received: from mail-ey0-f177.google.com ([209.85.215.177]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1RSp3R-0003j2-Lz for linux-arm-kernel@lists.infradead.org; Tue, 22 Nov 2011 12:02:29 +0000 Received: by mail-ey0-f177.google.com with SMTP id 3so83134eye.36 for ; Tue, 22 Nov 2011 04:02:25 -0800 (PST) Received: by 10.14.11.87 with SMTP id 63mr1335817eew.9.1321963345258; Tue, 22 Nov 2011 04:02:25 -0800 (PST) Received: from localhost.localdomain (128.50.18.95.dynamic.jazztel.es. [95.18.50.128]) by mx.google.com with ESMTPS id z58sm41113196eea.3.2011.11.22.04.02.22 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 22 Nov 2011 04:02:24 -0800 (PST) From: Javier Martin To: linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, m.szyprowski@samsung.com, laurent.pinchart@ideasonboard.com, s.nawrocki@samsung.com, hverkuil@xs4all.nl, kyungmin.park@samsung.com, shawn.guo@linaro.org, richard.zhao@linaro.org, fabio.estevam@freescale.com, kernel@pengutronix.de, s.hauer@pengutronix.de, r.schwebel@pengutronix.de Subject: [PATCH v2 1/2] MX2: Add platform definitions for eMMa-PrP device. Date: Tue, 22 Nov 2011 13:01:55 +0100 Message-Id: <1321963316-9058-2-git-send-email-javier.martin@vista-silicon.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1321963316-9058-1-git-send-email-javier.martin@vista-silicon.com> References: <1321963316-9058-1-git-send-email-javier.martin@vista-silicon.com> X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.215.177 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Javier Martin X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org eMMa-PrP device included in Freescale i.MX2 chips can also be used separately to process memory buffers. Signed-off-by: Javier Martin --- arch/arm/mach-imx/devices-imx27.h | 2 + arch/arm/plat-mxc/devices/platform-mx2-camera.c | 33 +++++++++++++++++++++++ arch/arm/plat-mxc/include/mach/devices-common.h | 2 + 3 files changed, 37 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-imx/devices-imx27.h b/arch/arm/mach-imx/devices-imx27.h index 2f727d7..519aa36 100644 --- a/arch/arm/mach-imx/devices-imx27.h +++ b/arch/arm/mach-imx/devices-imx27.h @@ -50,6 +50,8 @@ extern const struct imx_imx_uart_1irq_data imx27_imx_uart_data[]; extern const struct imx_mx2_camera_data imx27_mx2_camera_data; #define imx27_add_mx2_camera(pdata) \ imx_add_mx2_camera(&imx27_mx2_camera_data, pdata) +#define imx27_alloc_mx2_emmaprp(pdata) \ + imx_alloc_mx2_emmaprp(&imx27_mx2_camera_data) extern const struct imx_mxc_ehci_data imx27_mxc_ehci_otg_data; #define imx27_add_mxc_ehci_otg(pdata) \ diff --git a/arch/arm/plat-mxc/devices/platform-mx2-camera.c b/arch/arm/plat-mxc/devices/platform-mx2-camera.c index b3f4828..4a8bd73 100644 --- a/arch/arm/plat-mxc/devices/platform-mx2-camera.c +++ b/arch/arm/plat-mxc/devices/platform-mx2-camera.c @@ -6,6 +6,7 @@ * the terms of the GNU General Public License version 2 as published by the * Free Software Foundation. */ +#include #include #include @@ -62,3 +63,35 @@ struct platform_device *__init imx_add_mx2_camera( res, data->iobaseemmaprp ? 4 : 2, pdata, sizeof(*pdata), DMA_BIT_MASK(32)); } + +struct platform_device *__init imx_alloc_mx2_emmaprp( + const struct imx_mx2_camera_data *data) +{ + struct resource res[] = { + { + .start = data->iobaseemmaprp, + .end = data->iobaseemmaprp + data->iosizeemmaprp - 1, + .flags = IORESOURCE_MEM, + }, { + .start = data->irqemmaprp, + .end = data->irqemmaprp, + .flags = IORESOURCE_IRQ, + }, + }; + struct platform_device *pdev; + int ret = -ENOMEM; + + pdev = platform_device_alloc("m2m-emmaprp", 0); + if (!pdev) + goto err; + + ret = platform_device_add_resources(pdev, res, ARRAY_SIZE(res)); + if (ret) + goto err; + + return pdev; +err: + platform_device_put(pdev); + return ERR_PTR(-ENODEV); + +} diff --git a/arch/arm/plat-mxc/include/mach/devices-common.h b/arch/arm/plat-mxc/include/mach/devices-common.h index def9ba5..ce64bd5 100644 --- a/arch/arm/plat-mxc/include/mach/devices-common.h +++ b/arch/arm/plat-mxc/include/mach/devices-common.h @@ -223,6 +223,8 @@ struct imx_mx2_camera_data { struct platform_device *__init imx_add_mx2_camera( const struct imx_mx2_camera_data *data, const struct mx2_camera_platform_data *pdata); +struct platform_device *__init imx_alloc_mx2_emmaprp( + const struct imx_mx2_camera_data *data); #include struct imx_mxc_ehci_data {