From patchwork Tue Apr 3 19:20:06 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 150532 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 62152B6FCF for ; Wed, 4 Apr 2012 05:22:43 +1000 (EST) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1SF9HG-0000M8-KP; Tue, 03 Apr 2012 19:20:26 +0000 Received: from mail-gy0-f177.google.com ([209.85.160.177]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1SF9H9-0000LN-3s for linux-arm-kernel@lists.infradead.org; Tue, 03 Apr 2012 19:20:20 +0000 Received: by ghbf11 with SMTP id f11so38348ghb.36 for ; Tue, 03 Apr 2012 12:20:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=X11p3+6Ujfvip1bXnqbxxIFjomOBrJD2hwc/tk+NAUc=; b=jRdj0MY1poPw+uBRM0tVWk6zbcBLLqLXq5vK1UppvU83C2hO3DXrGk9nF6vMmYihlV 8cTe9X0r7Eo83vmOTaGw/r6y8fSu2qFGwOC9kSko9DKua1YPlvuyPMaIENYX+O5mbR6o L3FdwG+GHYfJgsWXL0gjBTRnTDsNSDiP8LxOCaXJ/i7vCywDkzJvVCQwfl/+Eak8e6JY LzqsS6kahYE0gZ4XznKYbryHsNpVptHuq1mIqH9Ei9mohW+bIVwrpbGO8o8QRGp6dZ7g c9x38kajL3bp4JX8TzNtnFGj1Miow86JRG2VJsF1OUrVrSHbXzoszrVcvv4ed+FZIwpt f7gw== Received: by 10.236.200.230 with SMTP id z66mr12484378yhn.20.1333480817906; Tue, 03 Apr 2012 12:20:17 -0700 (PDT) Received: from localhost.localdomain ([201.82.161.72]) by mx.google.com with ESMTPS id e45sm60728877yhk.2.2012.04.03.12.20.15 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 03 Apr 2012 12:20:16 -0700 (PDT) From: Fabio Estevam To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 2/3] ARM: mx28: Add SPI resources Date: Tue, 3 Apr 2012 16:20:06 -0300 Message-Id: <1333480807-10480-2-git-send-email-festevam@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1333480807-10480-1-git-send-email-festevam@gmail.com> References: <1333480807-10480-1-git-send-email-festevam@gmail.com> X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.160.177 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (festevam[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Fabio Estevam , shawn.guo@freescale.com, kernel@pengutronix.de 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 Add SPI resources. Signed-off-by: Fabio Estevam --- arch/arm/mach-mxs/devices-mx28.h | 4 + arch/arm/mach-mxs/devices/Kconfig | 3 + arch/arm/mach-mxs/devices/Makefile | 1 + arch/arm/mach-mxs/devices/platform-mxs-spi.c | 74 +++++++++++++++++++++++ arch/arm/mach-mxs/include/mach/devices-common.h | 11 ++++ 5 files changed, 93 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-mxs/devices/platform-mxs-spi.c diff --git a/arch/arm/mach-mxs/devices-mx28.h b/arch/arm/mach-mxs/devices-mx28.h index 9dbeae1..9b9206d 100644 --- a/arch/arm/mach-mxs/devices-mx28.h +++ b/arch/arm/mach-mxs/devices-mx28.h @@ -55,3 +55,7 @@ extern const struct mxs_saif_data mx28_saif_data[] __initconst; mxs_add_saif(&mx28_saif_data[id], pdata) struct platform_device *__init mx28_add_rtc_stmp3xxx(void); + +extern const struct mxs_mxs_spi_data mx28_mxs_spi_data[] __initconst; +#define mx28_add_mxs_spi(id) \ + mxs_add_mxs_spi(&mx28_mxs_spi_data[id]) diff --git a/arch/arm/mach-mxs/devices/Kconfig b/arch/arm/mach-mxs/devices/Kconfig index b8913df..8ba5fca 100644 --- a/arch/arm/mach-mxs/devices/Kconfig +++ b/arch/arm/mach-mxs/devices/Kconfig @@ -30,5 +30,8 @@ config MXS_HAVE_PLATFORM_MXSFB config MXS_HAVE_PLATFORM_MXS_SAIF bool +config MXS_HAVE_PLATFORM_MXS_SPI + bool + config MXS_HAVE_PLATFORM_RTC_STMP3XXX bool diff --git a/arch/arm/mach-mxs/devices/Makefile b/arch/arm/mach-mxs/devices/Makefile index c8f5c95..1664049 100644 --- a/arch/arm/mach-mxs/devices/Makefile +++ b/arch/arm/mach-mxs/devices/Makefile @@ -11,3 +11,4 @@ obj-y += platform-gpio-mxs.o obj-$(CONFIG_MXS_HAVE_PLATFORM_MXSFB) += platform-mxsfb.o obj-$(CONFIG_MXS_HAVE_PLATFORM_MXS_SAIF) += platform-mxs-saif.o obj-$(CONFIG_MXS_HAVE_PLATFORM_RTC_STMP3XXX) += platform-rtc-stmp3xxx.o +obj-$(CONFIG_MXS_HAVE_PLATFORM_MXS_SPI) += platform-mxs-spi.o diff --git a/arch/arm/mach-mxs/devices/platform-mxs-spi.c b/arch/arm/mach-mxs/devices/platform-mxs-spi.c new file mode 100644 index 0000000..b9e78d3 --- /dev/null +++ b/arch/arm/mach-mxs/devices/platform-mxs-spi.c @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2010 Pengutronix + * Uwe Kleine-Koenig + * + * Copyright 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 + +#include +#include +#include + +#define mxs_mxs_spi_data_entry_single(soc, _id, hwid) \ + { \ + .id = _id, \ + .iobase = soc ## _SSP ## hwid ## _BASE_ADDR, \ + .dma = soc ## _DMA_SSP ## hwid, \ + .irq_err = soc ## _INT_SSP ## hwid ## _ERROR, \ + .irq_dma = soc ## _INT_SSP ## hwid ## _DMA, \ + } + +#define mxs_mxs_spi_data_entry(soc, _id, hwid) \ + [_id] = mxs_mxs_spi_data_entry_single(soc, _id, hwid) + + +#ifdef CONFIG_SOC_IMX23 +const struct mxs_mxs_spi_data mx23_mxs_spi_data[] __initconst = { + mxs_mxs_spi_data_entry(MX23, 0, 1), + mxs_mxs_spi_data_entry(MX23, 1, 2), +}; +#endif + +#ifdef CONFIG_SOC_IMX28 +const struct mxs_mxs_spi_data mx28_mxs_spi_data[] __initconst = { + mxs_mxs_spi_data_entry(MX28, 0, 0), + mxs_mxs_spi_data_entry(MX28, 1, 1), + mxs_mxs_spi_data_entry(MX28, 2, 2), + mxs_mxs_spi_data_entry(MX28, 3, 3), +}; +#endif + +struct platform_device *__init mxs_add_mxs_spi( + const struct mxs_mxs_spi_data *data) +{ + struct resource res[] = { + { + .start = data->iobase, + .end = data->iobase + SZ_8K - 1, + .flags = IORESOURCE_MEM, + }, { + .start = data->dma, + .end = data->dma, + .flags = IORESOURCE_DMA, + }, { + .start = data->irq_err, + .end = data->irq_err, + .flags = IORESOURCE_IRQ, + }, { + .start = data->irq_dma, + .end = data->irq_dma, + .flags = IORESOURCE_IRQ, + }, + }; + + return mxs_add_platform_device("mxs-spi", data->id, + res, ARRAY_SIZE(res), NULL, 0); +} diff --git a/arch/arm/mach-mxs/include/mach/devices-common.h b/arch/arm/mach-mxs/include/mach/devices-common.h index f2e3839..2bb1d9e 100644 --- a/arch/arm/mach-mxs/include/mach/devices-common.h +++ b/arch/arm/mach-mxs/include/mach/devices-common.h @@ -116,3 +116,14 @@ struct mxs_saif_data { struct platform_device *__init mxs_add_saif( const struct mxs_saif_data *data, const struct mxs_saif_platform_data *pdata); + +/* spi */ +struct mxs_mxs_spi_data { + int id; + resource_size_t iobase; + resource_size_t dma; + resource_size_t irq_err; + resource_size_t irq_dma; +}; +struct platform_device *__init mxs_add_mxs_spi( + const struct mxs_mxs_spi_data *data);