From patchwork Mon Apr 18 10:43:47 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huang Shijie X-Patchwork-Id: 91710 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 7B280B6F71 for ; Mon, 18 Apr 2011 20:45:17 +1000 (EST) Received: from canuck.infradead.org ([2001:4978:20e::1]) by bombadil.infradead.org with esmtps (Exim 4.72 #1 (Red Hat Linux)) id 1QBlvq-0008Bw-DJ; Mon, 18 Apr 2011 10:43:50 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.72 #1 (Red Hat Linux)) id 1QBlvo-0001vr-Ht; Mon, 18 Apr 2011 10:43:48 +0000 Received: from ch1ehsobe002.messaging.microsoft.com ([216.32.181.182] helo=ch1outboundpool.messaging.microsoft.com) by canuck.infradead.org with esmtps (Exim 4.72 #1 (Red Hat Linux)) id 1QBlvP-0001ub-SS; Mon, 18 Apr 2011 10:43:28 +0000 Received: from mail203-ch1-R.bigfish.com (216.32.181.174) by CH1EHSOBE016.bigfish.com (10.43.70.66) with Microsoft SMTP Server id 14.1.225.8; Mon, 18 Apr 2011 10:43:21 +0000 Received: from mail203-ch1 (localhost.localdomain [127.0.0.1]) by mail203-ch1-R.bigfish.com (Postfix) with ESMTP id C2BAF2036D; Mon, 18 Apr 2011 10:43:21 +0000 (UTC) X-SpamScore: 6 X-BigFish: VS6(zzc8kzz1202h1082kzz8275bhz2dh2a8h668h839h61h) X-Spam-TCS-SCL: 0:0 X-Forefront-Antispam-Report: KIP:(null); UIP:(null); IPVD:NLI; H:mail.freescale.net; RD:none; EFVD:NLI Received: from mail203-ch1 (localhost.localdomain [127.0.0.1]) by mail203-ch1 (MessageSwitch) id 1303123401382996_4077; Mon, 18 Apr 2011 10:43:21 +0000 (UTC) Received: from CH1EHSMHS006.bigfish.com (snatpool1.int.messaging.microsoft.com [10.43.68.242]) by mail203-ch1.bigfish.com (Postfix) with ESMTP id 4F0F723804B; Mon, 18 Apr 2011 10:43:21 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by CH1EHSMHS006.bigfish.com (10.43.70.6) with Microsoft SMTP Server (TLS) id 14.1.225.8; Mon, 18 Apr 2011 10:43:19 +0000 Received: from az33smr02.freescale.net (10.64.34.200) by 039-SN1MMR1-003.039d.mgd.msft.net (10.84.1.16) with Microsoft SMTP Server id 14.1.270.2; Mon, 18 Apr 2011 05:43:18 -0500 Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by az33smr02.freescale.net (8.13.1/8.13.0) with ESMTP id p3IAhDxu021107; Mon, 18 Apr 2011 05:43:16 -0500 (CDT) From: Huang Shijie To: Subject: [PATCH V2 2/3] ARM: mxs: add GPMI device for imx23 Date: Mon, 18 Apr 2011 18:43:47 +0800 Message-ID: <1303123428-12266-2-git-send-email-b32955@freescale.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1303123428-12266-1-git-send-email-b32955@freescale.com> References: <1303123428-12266-1-git-send-email-b32955@freescale.com> MIME-Version: 1.0 X-OriginatorOrg: freescale.com X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110418_064324_153009_0EAAA075 X-CRM114-Status: GOOD ( 20.69 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [216.32.181.182 listed in list.dnswl.org] Cc: Huang Shijie , linux-mtd@lists.infradead.org, linux-arm-kernel@lists.infradead.org, u.kleine-koenig@pengutronix.de X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org add the gpmi device for imx23. Signed-off-by: Huang Shijie --- arch/arm/mach-mxs/clock-mx23.c | 1 + arch/arm/mach-mxs/devices-mx23.h | 3 + arch/arm/mach-mxs/devices/Kconfig | 3 + arch/arm/mach-mxs/devices/Makefile | 1 + arch/arm/mach-mxs/devices/platform-gpmi.c | 71 +++++++++++++++++++++++ arch/arm/mach-mxs/include/mach/devices-common.h | 10 +++ arch/arm/mach-mxs/mach-mx23evk.c | 28 +++++++++ 7 files changed, 117 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-mxs/devices/platform-gpmi.c diff --git a/arch/arm/mach-mxs/clock-mx23.c b/arch/arm/mach-mxs/clock-mx23.c index d133c7f..81d54bf 100644 --- a/arch/arm/mach-mxs/clock-mx23.c +++ b/arch/arm/mach-mxs/clock-mx23.c @@ -454,6 +454,7 @@ static struct clk_lookup lookups[] = { _REGISTER_CLOCK("mxs-pwm.3", NULL, pwm_clk) _REGISTER_CLOCK("mxs-pwm.4", NULL, pwm_clk) _REGISTER_CLOCK("imx23-fb", NULL, lcdif_clk) + _REGISTER_CLOCK("imx23-gpmi-nfc", NULL, gpmi_clk) }; static int clk_misc_init(void) diff --git a/arch/arm/mach-mxs/devices-mx23.h b/arch/arm/mach-mxs/devices-mx23.h index c7e14f4..48d4766 100644 --- a/arch/arm/mach-mxs/devices-mx23.h +++ b/arch/arm/mach-mxs/devices-mx23.h @@ -21,6 +21,9 @@ extern const struct mxs_auart_data mx23_auart_data[] __initconst; #define mx23_add_auart0() mx23_add_auart(0) #define mx23_add_auart1() mx23_add_auart(1) +extern const struct mxs_gpmi_data mx23_gpmi_data __initconst; +#define mx23_add_gpmi_nfc(pdata) mxs_add_gpmi_nfc(pdata, &mx23_gpmi_data) + #define mx23_add_mxs_pwm(id) mxs_add_mxs_pwm(MX23_PWM_BASE_ADDR, id) struct platform_device *__init mx23_add_mxsfb( diff --git a/arch/arm/mach-mxs/devices/Kconfig b/arch/arm/mach-mxs/devices/Kconfig index 1451ad0..072c8e5 100644 --- a/arch/arm/mach-mxs/devices/Kconfig +++ b/arch/arm/mach-mxs/devices/Kconfig @@ -12,6 +12,9 @@ config MXS_HAVE_PLATFORM_FLEXCAN select HAVE_CAN_FLEXCAN if CAN bool +config MXS_HAVE_PLATFORM_GPMI_NFC + bool + config MXS_HAVE_PLATFORM_MXS_I2C bool diff --git a/arch/arm/mach-mxs/devices/Makefile b/arch/arm/mach-mxs/devices/Makefile index 0d9bea3..7735e45 100644 --- a/arch/arm/mach-mxs/devices/Makefile +++ b/arch/arm/mach-mxs/devices/Makefile @@ -3,6 +3,7 @@ obj-$(CONFIG_MXS_HAVE_PLATFORM_AUART) += platform-auart.o obj-y += platform-dma.o obj-$(CONFIG_MXS_HAVE_PLATFORM_FEC) += platform-fec.o obj-$(CONFIG_MXS_HAVE_PLATFORM_FLEXCAN) += platform-flexcan.o +obj-$(CONFIG_MXS_HAVE_PLATFORM_GPMI_NFC) += platform-gpmi.o obj-$(CONFIG_MXS_HAVE_PLATFORM_MXS_I2C) += platform-mxs-i2c.o obj-$(CONFIG_MXS_HAVE_PLATFORM_MXS_PWM) += platform-mxs-pwm.o obj-$(CONFIG_MXS_HAVE_PLATFORM_MXSFB) += platform-mxsfb.o diff --git a/arch/arm/mach-mxs/devices/platform-gpmi.c b/arch/arm/mach-mxs/devices/platform-gpmi.c new file mode 100644 index 0000000..3c6c968 --- /dev/null +++ b/arch/arm/mach-mxs/devices/platform-gpmi.c @@ -0,0 +1,71 @@ +/* + * 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 +#include +#include +#include + +#define RES_MEM(soc, _id, _s, _n) \ + { \ + .start = soc ##_## _id, \ + .end = soc ##_## _id + (_s) - 1, \ + .name = (_n), \ + .flags = IORESOURCE_MEM, \ + } + +#define RES_IRQ(soc, _id, _n) \ + { \ + .start = soc ##_## _id, \ + .end = soc ##_## _id, \ + .name = (_n), \ + .flags = IORESOURCE_IRQ, \ + } + +#define RES_DMA(soc, _i_s, _i_e, _n) \ + { \ + .start = soc ##_## _i_s, \ + .end = soc ##_## _i_e, \ + .name = (_n), \ + .flags = IORESOURCE_DMA, \ + } + +#ifdef CONFIG_SOC_IMX23 +const struct mxs_gpmi_data mx23_gpmi_data __initconst = { + .devid = "imx23-gpmi-nfc", + .res = { + /* GPMI */ + RES_MEM(MX23, GPMI_BASE_ADDR, SZ_8K, GPMI_NFC_GPMI_REGS_ADDR_RES_NAME), + RES_IRQ(MX23, INT_GPMI_ATTENTION, GPMI_NFC_GPMI_INTERRUPT_RES_NAME), + /* BCH */ + RES_MEM(MX23, BCH_BASE_ADDR, SZ_8K, GPMI_NFC_BCH_REGS_ADDR_RES_NAME), + RES_IRQ(MX23, INT_BCH, GPMI_NFC_BCH_INTERRUPT_RES_NAME), + /* DMA */ + RES_DMA(MX23, DMA_GPMI0, DMA_GPMI3, GPMI_NFC_DMA_CHANNELS_RES_NAME), + RES_IRQ(MX23, INT_GPMI_DMA, GPMI_NFC_DMA_INTERRUPT_RES_NAME), + }, +}; +#endif + +struct platform_device *__init +mxs_add_gpmi_nfc(const struct gpmi_nfc_platform_data *pdata, + const struct mxs_gpmi_data *data) +{ + return mxs_add_platform_device_dmamask(data->devid, -1, + data->res, RES_SIZE, + pdata, sizeof(*pdata), DMA_BIT_MASK(32)); +} diff --git a/arch/arm/mach-mxs/include/mach/devices-common.h b/arch/arm/mach-mxs/include/mach/devices-common.h index 71f2448..fc59c05 100644 --- a/arch/arm/mach-mxs/include/mach/devices-common.h +++ b/arch/arm/mach-mxs/include/mach/devices-common.h @@ -64,6 +64,16 @@ struct platform_device *__init mxs_add_flexcan( const struct mxs_flexcan_data *data, const struct flexcan_platform_data *pdata); +/* gpmi */ +#include +struct mxs_gpmi_data { + const char *devid; + const struct resource res[RES_SIZE]; +}; +struct platform_device *__init +mxs_add_gpmi_nfc(const struct gpmi_nfc_platform_data *pdata, + const struct mxs_gpmi_data *data); + /* i2c */ struct mxs_i2c_data { int id; diff --git a/arch/arm/mach-mxs/mach-mx23evk.c b/arch/arm/mach-mxs/mach-mx23evk.c index a66994f..666e0f8 100644 --- a/arch/arm/mach-mxs/mach-mx23evk.c +++ b/arch/arm/mach-mxs/mach-mx23evk.c @@ -40,6 +40,26 @@ static const iomux_cfg_t mx23evk_pads[] __initconst = { MX23_PAD_AUART1_CTS__AUART1_CTS | MXS_PAD_CTRL, MX23_PAD_AUART1_RTS__AUART1_RTS | MXS_PAD_CTRL, +#define MXS_PAD_GPMI (MXS_PAD_12MA | MXS_PAD_3V3 | MXS_PAD_NOPULL) + /* gpmi */ + MX23_PAD_GPMI_D00__GPMI_D00 | MXS_PAD_CTRL, + MX23_PAD_GPMI_D01__GPMI_D01 | MXS_PAD_CTRL, + MX23_PAD_GPMI_D02__GPMI_D02 | MXS_PAD_CTRL, + MX23_PAD_GPMI_D03__GPMI_D03 | MXS_PAD_CTRL, + MX23_PAD_GPMI_D04__GPMI_D04 | MXS_PAD_CTRL, + MX23_PAD_GPMI_D05__GPMI_D05 | MXS_PAD_CTRL, + MX23_PAD_GPMI_D06__GPMI_D06 | MXS_PAD_CTRL, + MX23_PAD_GPMI_D07__GPMI_D07 | MXS_PAD_CTRL, + MX23_PAD_GPMI_CLE__GPMI_CLE | MXS_PAD_CTRL, + MX23_PAD_GPMI_ALE__GPMI_ALE | MXS_PAD_CTRL, + MX23_PAD_GPMI_WPN__GPMI_WPN | MXS_PAD_GPMI, + MX23_PAD_GPMI_WRN__GPMI_WRN | MXS_PAD_GPMI, + MX23_PAD_GPMI_RDN__GPMI_RDN | MXS_PAD_GPMI, + MX23_PAD_GPMI_RDY0__GPMI_RDY0 | MXS_PAD_CTRL, + MX23_PAD_GPMI_RDY1__GPMI_RDY1 | MXS_PAD_CTRL, + MX23_PAD_GPMI_CE0N__GPMI_CE0N | MXS_PAD_CTRL, + MX23_PAD_GPMI_CE1N__GPMI_CE1N | MXS_PAD_CTRL, + /* mxsfb (lcdif) */ MX23_PAD_LCD_D00__LCD_D00 | MXS_PAD_CTRL, MX23_PAD_LCD_D01__LCD_D01 | MXS_PAD_CTRL, @@ -75,6 +95,13 @@ static const iomux_cfg_t mx23evk_pads[] __initconst = { MX23_PAD_PWM2__GPIO_1_28 | MXS_PAD_CTRL, }; +/* gpmi */ +static const struct gpmi_nfc_platform_data mx23evk_gpmi_pdata __initconst = { + .min_prop_delay_in_ns = 5, + .max_prop_delay_in_ns = 9, + .max_chip_count = 1, +}; + /* mxsfb (lcdif) */ static struct fb_videomode mx23evk_video_modes[] = { { @@ -122,6 +149,7 @@ static void __init mx23evk_init(void) else gpio_set_value(MX23EVK_BL_ENABLE, 1); + mx23_add_gpmi_nfc(&mx23evk_gpmi_pdata); mx23_add_mxsfb(&mx23evk_mxsfb_pdata); }