All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] ARM: mxs: add GPMI support for imx23/imx28
@ 2011-04-15  8:01 ` Huang Shijie
  0 siblings, 0 replies; 16+ messages in thread
From: Huang Shijie @ 2011-04-15  8:01 UTC (permalink / raw)
  To: s.hauer; +Cc: Huang Shijie, linux-mtd, linux-arm-kernel, u.kleine-koenig

add gpmi support for imx23 and imx28.

Signed-off-by: Huang Shijie <b32955@freescale.com>
---
 arch/arm/mach-mxs/Kconfig                 |    2 +
 arch/arm/mach-mxs/include/mach/gpmi-nfc.h |   68 +++++++++++++++++++++++++++++
 2 files changed, 70 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-mxs/include/mach/gpmi-nfc.h

diff --git a/arch/arm/mach-mxs/Kconfig b/arch/arm/mach-mxs/Kconfig
index 4f6f174..e034666 100644
--- a/arch/arm/mach-mxs/Kconfig
+++ b/arch/arm/mach-mxs/Kconfig
@@ -22,6 +22,7 @@ config MACH_MX23EVK
 	select SOC_IMX23
 	select MXS_HAVE_AMBA_DUART
 	select MXS_HAVE_PLATFORM_AUART
+	select MXS_HAVE_PLATFORM_GPMI
 	select MXS_HAVE_PLATFORM_MXSFB
 	default y
 	help
@@ -35,6 +36,7 @@ config MACH_MX28EVK
 	select MXS_HAVE_PLATFORM_AUART
 	select MXS_HAVE_PLATFORM_FEC
 	select MXS_HAVE_PLATFORM_FLEXCAN
+	select MXS_HAVE_PLATFORM_GPMI
 	select MXS_HAVE_PLATFORM_MXSFB
 	select MXS_OCOTP
 	default y
diff --git a/arch/arm/mach-mxs/include/mach/gpmi-nfc.h b/arch/arm/mach-mxs/include/mach/gpmi-nfc.h
new file mode 100644
index 0000000..32c8ad9
--- /dev/null
+++ b/arch/arm/mach-mxs/include/mach/gpmi-nfc.h
@@ -0,0 +1,68 @@
+/*
+ * 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.
+ */
+
+#ifndef __INCLUDE_GPMI_DEVICE_H
+#define __INCLUDE_GPMI_DEVICE_H
+
+#define GPMI_NFC_DRIVER_NAME	"gpmi-nfc"
+#define GPMI_NFC_DRIVER_MX23	"imx23-gpmi-nfc"
+#define GPMI_NFC_DRIVER_MX28	"imx28-gpmi-nfc"
+#define GPMI_NFC_DRIVER_MX50	"imx50-gpmi-nfc"
+
+/* The size of the resource is fixed. */
+#define RES_SIZE	6
+
+/* Resource names for the GPMI NFC driver. */
+#define GPMI_NFC_GPMI_REGS_ADDR_RES_NAME  "GPMI NFC GPMI Registers"
+#define GPMI_NFC_GPMI_INTERRUPT_RES_NAME  "GPMI NFC GPMI Interrupt"
+#define GPMI_NFC_BCH_REGS_ADDR_RES_NAME   "GPMI NFC BCH Registers"
+#define GPMI_NFC_BCH_INTERRUPT_RES_NAME   "GPMI NFC BCH Interrupt"
+#define GPMI_NFC_DMA_CHANNELS_RES_NAME    "GPMI NFC DMA Channels"
+#define GPMI_NFC_DMA_INTERRUPT_RES_NAME   "GPMI NFC DMA Interrupt"
+
+/**
+ * struct gpmi_nfc_platform_data - GPMI NFC driver platform data.
+ *
+ * This structure communicates platform-specific information to the GPMI NFC
+ * driver that can't be expressed as resources.
+ *
+ * @min_prop_delay_in_ns:    Minimum propagation delay of GPMI signals to and
+ *                           from the NAND Flash device, in nanoseconds.
+ * @max_prop_delay_in_ns:    Maximum propagation delay of GPMI signals to and
+ *                           from the NAND Flash device, in nanoseconds.
+ * @max_chip_count:          The maximum number of chips for which the driver
+ *                           should configure the hardware. This value most
+ *                           likely reflects the number of pins that are
+ *                           connected to a NAND Flash device. If this is
+ *                           greater than the SoC hardware can support, the
+ *                           driver will print a message and fail to initialize.
+ * @partitions:              An optional pointer to an array of partition
+ *                           descriptions.
+ * @partition_count:         The number of elements in the partitions array.
+ */
+struct gpmi_nfc_platform_data {
+	/* NAND Flash information. */
+	unsigned int          min_prop_delay_in_ns;
+	unsigned int          max_prop_delay_in_ns;
+	unsigned int          max_chip_count;
+
+	/* soc */
+	struct mtd_partition  *partitions;
+	unsigned              partition_count;
+};
+#endif
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 1/2] ARM: mxs: add GPMI support for imx23/imx28
@ 2011-04-15  8:01 ` Huang Shijie
  0 siblings, 0 replies; 16+ messages in thread
From: Huang Shijie @ 2011-04-15  8:01 UTC (permalink / raw)
  To: linux-arm-kernel

add gpmi support for imx23 and imx28.

Signed-off-by: Huang Shijie <b32955@freescale.com>
---
 arch/arm/mach-mxs/Kconfig                 |    2 +
 arch/arm/mach-mxs/include/mach/gpmi-nfc.h |   68 +++++++++++++++++++++++++++++
 2 files changed, 70 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-mxs/include/mach/gpmi-nfc.h

diff --git a/arch/arm/mach-mxs/Kconfig b/arch/arm/mach-mxs/Kconfig
index 4f6f174..e034666 100644
--- a/arch/arm/mach-mxs/Kconfig
+++ b/arch/arm/mach-mxs/Kconfig
@@ -22,6 +22,7 @@ config MACH_MX23EVK
 	select SOC_IMX23
 	select MXS_HAVE_AMBA_DUART
 	select MXS_HAVE_PLATFORM_AUART
+	select MXS_HAVE_PLATFORM_GPMI
 	select MXS_HAVE_PLATFORM_MXSFB
 	default y
 	help
@@ -35,6 +36,7 @@ config MACH_MX28EVK
 	select MXS_HAVE_PLATFORM_AUART
 	select MXS_HAVE_PLATFORM_FEC
 	select MXS_HAVE_PLATFORM_FLEXCAN
+	select MXS_HAVE_PLATFORM_GPMI
 	select MXS_HAVE_PLATFORM_MXSFB
 	select MXS_OCOTP
 	default y
diff --git a/arch/arm/mach-mxs/include/mach/gpmi-nfc.h b/arch/arm/mach-mxs/include/mach/gpmi-nfc.h
new file mode 100644
index 0000000..32c8ad9
--- /dev/null
+++ b/arch/arm/mach-mxs/include/mach/gpmi-nfc.h
@@ -0,0 +1,68 @@
+/*
+ * 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.
+ */
+
+#ifndef __INCLUDE_GPMI_DEVICE_H
+#define __INCLUDE_GPMI_DEVICE_H
+
+#define GPMI_NFC_DRIVER_NAME	"gpmi-nfc"
+#define GPMI_NFC_DRIVER_MX23	"imx23-gpmi-nfc"
+#define GPMI_NFC_DRIVER_MX28	"imx28-gpmi-nfc"
+#define GPMI_NFC_DRIVER_MX50	"imx50-gpmi-nfc"
+
+/* The size of the resource is fixed. */
+#define RES_SIZE	6
+
+/* Resource names for the GPMI NFC driver. */
+#define GPMI_NFC_GPMI_REGS_ADDR_RES_NAME  "GPMI NFC GPMI Registers"
+#define GPMI_NFC_GPMI_INTERRUPT_RES_NAME  "GPMI NFC GPMI Interrupt"
+#define GPMI_NFC_BCH_REGS_ADDR_RES_NAME   "GPMI NFC BCH Registers"
+#define GPMI_NFC_BCH_INTERRUPT_RES_NAME   "GPMI NFC BCH Interrupt"
+#define GPMI_NFC_DMA_CHANNELS_RES_NAME    "GPMI NFC DMA Channels"
+#define GPMI_NFC_DMA_INTERRUPT_RES_NAME   "GPMI NFC DMA Interrupt"
+
+/**
+ * struct gpmi_nfc_platform_data - GPMI NFC driver platform data.
+ *
+ * This structure communicates platform-specific information to the GPMI NFC
+ * driver that can't be expressed as resources.
+ *
+ * @min_prop_delay_in_ns:    Minimum propagation delay of GPMI signals to and
+ *                           from the NAND Flash device, in nanoseconds.
+ * @max_prop_delay_in_ns:    Maximum propagation delay of GPMI signals to and
+ *                           from the NAND Flash device, in nanoseconds.
+ * @max_chip_count:          The maximum number of chips for which the driver
+ *                           should configure the hardware. This value most
+ *                           likely reflects the number of pins that are
+ *                           connected to a NAND Flash device. If this is
+ *                           greater than the SoC hardware can support, the
+ *                           driver will print a message and fail to initialize.
+ * @partitions:              An optional pointer to an array of partition
+ *                           descriptions.
+ * @partition_count:         The number of elements in the partitions array.
+ */
+struct gpmi_nfc_platform_data {
+	/* NAND Flash information. */
+	unsigned int          min_prop_delay_in_ns;
+	unsigned int          max_prop_delay_in_ns;
+	unsigned int          max_chip_count;
+
+	/* soc */
+	struct mtd_partition  *partitions;
+	unsigned              partition_count;
+};
+#endif
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 2/2] ARM: mxs: add GPMI device for imx23/imx28
  2011-04-15  8:01 ` Huang Shijie
@ 2011-04-15  8:01   ` Huang Shijie
  -1 siblings, 0 replies; 16+ messages in thread
From: Huang Shijie @ 2011-04-15  8:01 UTC (permalink / raw)
  To: s.hauer; +Cc: Huang Shijie, linux-mtd, linux-arm-kernel, u.kleine-koenig

add the gpmi device for imx23 and imx28.

Signed-off-by: Huang Shijie <b32955@freescale.com>
---
 arch/arm/mach-mxs/clock-mx23.c                  |    1 +
 arch/arm/mach-mxs/clock-mx28.c                  |    1 +
 arch/arm/mach-mxs/devices-mx23.h                |    4 +
 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-gpmi.c       |   82 +++++++++++++++++++++++
 arch/arm/mach-mxs/include/mach/devices-common.h |    6 ++
 arch/arm/mach-mxs/mach-mx23evk.c                |   28 ++++++++
 arch/arm/mach-mxs/mach-mx28evk.c                |   28 ++++++++
 10 files changed, 158 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/clock-mx28.c b/arch/arm/mach-mxs/clock-mx28.c
index 5e489a2..9dbd2d5 100644
--- a/arch/arm/mach-mxs/clock-mx28.c
+++ b/arch/arm/mach-mxs/clock-mx28.c
@@ -609,6 +609,7 @@ static struct clk_lookup lookups[] = {
 	_REGISTER_CLOCK("duart", NULL, uart_clk)
 	_REGISTER_CLOCK("imx28-fec.0", NULL, fec_clk)
 	_REGISTER_CLOCK("imx28-fec.1", NULL, fec_clk)
+	_REGISTER_CLOCK("imx28-gpmi-nfc", NULL, gpmi_clk)
 	_REGISTER_CLOCK("mxs-auart.0", NULL, uart_clk)
 	_REGISTER_CLOCK("mxs-auart.1", NULL, uart_clk)
 	_REGISTER_CLOCK("mxs-auart.2", NULL, uart_clk)
diff --git a/arch/arm/mach-mxs/devices-mx23.h b/arch/arm/mach-mxs/devices-mx23.h
index c7e14f4..03bd234 100644
--- a/arch/arm/mach-mxs/devices-mx23.h
+++ b/arch/arm/mach-mxs/devices-mx23.h
@@ -21,6 +21,10 @@ 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 resource res_imx23[RES_SIZE] __initconst;
+#define mx23_add_gpmi(pdata)	\
+	mxs_add_gpmi(pdata, res_imx23, RES_SIZE, GPMI_NFC_DRIVER_MX23)
+
 #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-mx28.h b/arch/arm/mach-mxs/devices-mx28.h
index 9d08555..64458fd 100644
--- a/arch/arm/mach-mxs/devices-mx28.h
+++ b/arch/arm/mach-mxs/devices-mx28.h
@@ -34,6 +34,10 @@ extern const struct mxs_flexcan_data mx28_flexcan_data[] __initconst;
 #define mx28_add_flexcan0(pdata)	mx28_add_flexcan(0, pdata)
 #define mx28_add_flexcan1(pdata)	mx28_add_flexcan(1, pdata)
 
+extern const struct resource res_imx28[RES_SIZE] __initconst;
+#define mx28_add_gpmi(pdata)	\
+	mxs_add_gpmi(pdata, res_imx28, RES_SIZE, GPMI_NFC_DRIVER_MX28)
+
 extern const struct mxs_i2c_data mx28_mxs_i2c_data[] __initconst;
 #define mx28_add_mxs_i2c(id)		mxs_add_mxs_i2c(&mx28_mxs_i2c_data[id])
 
diff --git a/arch/arm/mach-mxs/devices/Kconfig b/arch/arm/mach-mxs/devices/Kconfig
index 1451ad0..e9a9a8b 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
+	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..4f2f66c 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) += 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..46f5e52
--- /dev/null
+++ b/arch/arm/mach-mxs/devices/platform-gpmi.c
@@ -0,0 +1,82 @@
+/*
+ * 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 <asm/sizes.h>
+#include <mach/mx23.h>
+#include <mach/mx28.h>
+#include <mach/devices-common.h>
+
+#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 resource res_imx23[RES_SIZE] __initconst = {
+	/* 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
+
+#ifdef CONFIG_SOC_IMX28
+const struct resource res_imx28[RES_SIZE] __initconst = {
+	/* GPMI */
+	RES_MEM(MX28, GPMI_BASE_ADDR, SZ_8K, GPMI_NFC_GPMI_REGS_ADDR_RES_NAME),
+	RES_IRQ(MX28, INT_GPMI, GPMI_NFC_GPMI_INTERRUPT_RES_NAME),
+	/* BCH */
+	RES_MEM(MX28, BCH_BASE_ADDR, SZ_8K, GPMI_NFC_BCH_REGS_ADDR_RES_NAME),
+	RES_IRQ(MX28, INT_BCH, GPMI_NFC_BCH_INTERRUPT_RES_NAME),
+	/* DMA */
+	RES_DMA(MX28, DMA_GPMI0, DMA_GPMI7, GPMI_NFC_DMA_CHANNELS_RES_NAME),
+	RES_IRQ(MX28, INT_GPMI_DMA, GPMI_NFC_DMA_INTERRUPT_RES_NAME),
+};
+#endif
+
+struct platform_device *__init
+mxs_add_gpmi(const struct gpmi_nfc_platform_data *data,
+		const struct resource *res, int res_size, const char *name)
+{
+	return mxs_add_platform_device_dmamask(name, -1,
+				res, res_size,
+				data, sizeof(*data), 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..8c8a487 100644
--- a/arch/arm/mach-mxs/include/mach/devices-common.h
+++ b/arch/arm/mach-mxs/include/mach/devices-common.h
@@ -64,6 +64,12 @@ struct platform_device *__init mxs_add_flexcan(
 		const struct mxs_flexcan_data *data,
 		const struct flexcan_platform_data *pdata);
 
+/* gpmi */
+#include <mach/gpmi-nfc.h>
+struct platform_device *__init
+mxs_add_gpmi(const struct gpmi_nfc_platform_data *data,
+		const struct resource *res, int res_size, const char *name);
+
 /* 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..9b808e1 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(&mx23evk_gpmi_pdata);
 	mx23_add_mxsfb(&mx23evk_mxsfb_pdata);
 }
 
diff --git a/arch/arm/mach-mxs/mach-mx28evk.c b/arch/arm/mach-mxs/mach-mx28evk.c
index 08002d0..8b165f8 100644
--- a/arch/arm/mach-mxs/mach-mx28evk.c
+++ b/arch/arm/mach-mxs/mach-mx28evk.c
@@ -82,6 +82,26 @@ static const iomux_cfg_t mx28evk_pads[] __initconst = {
 	/* transceiver power control */
 	MX28_PAD_SSP1_CMD__GPIO_2_13,
 
+#define MXS_PAD_GPMI	(MXS_PAD_12MA | MXS_PAD_3V3 | MXS_PAD_NOPULL)
+	/* gpmi */
+	MX28_PAD_GPMI_D00__GPMI_D0 | MXS_PAD_CTRL,
+	MX28_PAD_GPMI_D01__GPMI_D1 | MXS_PAD_CTRL,
+	MX28_PAD_GPMI_D02__GPMI_D2 | MXS_PAD_CTRL,
+	MX28_PAD_GPMI_D03__GPMI_D3 | MXS_PAD_CTRL,
+	MX28_PAD_GPMI_D04__GPMI_D4 | MXS_PAD_CTRL,
+	MX28_PAD_GPMI_D05__GPMI_D5 | MXS_PAD_CTRL,
+	MX28_PAD_GPMI_D06__GPMI_D6 | MXS_PAD_CTRL,
+	MX28_PAD_GPMI_D07__GPMI_D7 | MXS_PAD_CTRL,
+	MX28_PAD_GPMI_ALE__GPMI_ALE | MXS_PAD_CTRL,
+	MX28_PAD_GPMI_CLE__GPMI_CLE | MXS_PAD_CTRL,
+	MX28_PAD_GPMI_CE0N__GPMI_CE0N | MXS_PAD_CTRL,
+	MX28_PAD_GPMI_CE1N__GPMI_CE1N | MXS_PAD_CTRL,
+	MX28_PAD_GPMI_RDY0__GPMI_READY0 | MXS_PAD_CTRL,
+	MX28_PAD_GPMI_RDY1__GPMI_READY1 | MXS_PAD_CTRL,
+	MX28_PAD_GPMI_RDN__GPMI_RDN | MXS_PAD_GPMI,
+	MX28_PAD_GPMI_WRN__GPMI_WRN | MXS_PAD_GPMI,
+	MX28_PAD_GPMI_RESETN__GPMI_RESETN | MXS_PAD_GPMI,
+
 	/* mxsfb (lcdif) */
 	MX28_PAD_LCD_D00__LCD_D0 | MXS_PAD_CTRL,
 	MX28_PAD_LCD_D01__LCD_D1 | MXS_PAD_CTRL,
@@ -232,6 +252,13 @@ static const struct flexcan_platform_data
 	}
 };
 
+/* gpmi */
+static const struct gpmi_nfc_platform_data  mx28evk_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 mx28evk_video_modes[] = {
 	{
@@ -296,6 +323,7 @@ static void __init mx28evk_init(void)
 	else
 		gpio_set_value(MX28EVK_BL_ENABLE, 1);
 
+	mx28_add_gpmi(&mx28evk_gpmi_pdata);
 	mx28_add_mxsfb(&mx28evk_mxsfb_pdata);
 }
 
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 2/2] ARM: mxs: add GPMI device for imx23/imx28
@ 2011-04-15  8:01   ` Huang Shijie
  0 siblings, 0 replies; 16+ messages in thread
From: Huang Shijie @ 2011-04-15  8:01 UTC (permalink / raw)
  To: linux-arm-kernel

add the gpmi device for imx23 and imx28.

Signed-off-by: Huang Shijie <b32955@freescale.com>
---
 arch/arm/mach-mxs/clock-mx23.c                  |    1 +
 arch/arm/mach-mxs/clock-mx28.c                  |    1 +
 arch/arm/mach-mxs/devices-mx23.h                |    4 +
 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-gpmi.c       |   82 +++++++++++++++++++++++
 arch/arm/mach-mxs/include/mach/devices-common.h |    6 ++
 arch/arm/mach-mxs/mach-mx23evk.c                |   28 ++++++++
 arch/arm/mach-mxs/mach-mx28evk.c                |   28 ++++++++
 10 files changed, 158 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/clock-mx28.c b/arch/arm/mach-mxs/clock-mx28.c
index 5e489a2..9dbd2d5 100644
--- a/arch/arm/mach-mxs/clock-mx28.c
+++ b/arch/arm/mach-mxs/clock-mx28.c
@@ -609,6 +609,7 @@ static struct clk_lookup lookups[] = {
 	_REGISTER_CLOCK("duart", NULL, uart_clk)
 	_REGISTER_CLOCK("imx28-fec.0", NULL, fec_clk)
 	_REGISTER_CLOCK("imx28-fec.1", NULL, fec_clk)
+	_REGISTER_CLOCK("imx28-gpmi-nfc", NULL, gpmi_clk)
 	_REGISTER_CLOCK("mxs-auart.0", NULL, uart_clk)
 	_REGISTER_CLOCK("mxs-auart.1", NULL, uart_clk)
 	_REGISTER_CLOCK("mxs-auart.2", NULL, uart_clk)
diff --git a/arch/arm/mach-mxs/devices-mx23.h b/arch/arm/mach-mxs/devices-mx23.h
index c7e14f4..03bd234 100644
--- a/arch/arm/mach-mxs/devices-mx23.h
+++ b/arch/arm/mach-mxs/devices-mx23.h
@@ -21,6 +21,10 @@ 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 resource res_imx23[RES_SIZE] __initconst;
+#define mx23_add_gpmi(pdata)	\
+	mxs_add_gpmi(pdata, res_imx23, RES_SIZE, GPMI_NFC_DRIVER_MX23)
+
 #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-mx28.h b/arch/arm/mach-mxs/devices-mx28.h
index 9d08555..64458fd 100644
--- a/arch/arm/mach-mxs/devices-mx28.h
+++ b/arch/arm/mach-mxs/devices-mx28.h
@@ -34,6 +34,10 @@ extern const struct mxs_flexcan_data mx28_flexcan_data[] __initconst;
 #define mx28_add_flexcan0(pdata)	mx28_add_flexcan(0, pdata)
 #define mx28_add_flexcan1(pdata)	mx28_add_flexcan(1, pdata)
 
+extern const struct resource res_imx28[RES_SIZE] __initconst;
+#define mx28_add_gpmi(pdata)	\
+	mxs_add_gpmi(pdata, res_imx28, RES_SIZE, GPMI_NFC_DRIVER_MX28)
+
 extern const struct mxs_i2c_data mx28_mxs_i2c_data[] __initconst;
 #define mx28_add_mxs_i2c(id)		mxs_add_mxs_i2c(&mx28_mxs_i2c_data[id])
 
diff --git a/arch/arm/mach-mxs/devices/Kconfig b/arch/arm/mach-mxs/devices/Kconfig
index 1451ad0..e9a9a8b 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
+	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..4f2f66c 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) += 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..46f5e52
--- /dev/null
+++ b/arch/arm/mach-mxs/devices/platform-gpmi.c
@@ -0,0 +1,82 @@
+/*
+ * 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 <asm/sizes.h>
+#include <mach/mx23.h>
+#include <mach/mx28.h>
+#include <mach/devices-common.h>
+
+#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 resource res_imx23[RES_SIZE] __initconst = {
+	/* 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
+
+#ifdef CONFIG_SOC_IMX28
+const struct resource res_imx28[RES_SIZE] __initconst = {
+	/* GPMI */
+	RES_MEM(MX28, GPMI_BASE_ADDR, SZ_8K, GPMI_NFC_GPMI_REGS_ADDR_RES_NAME),
+	RES_IRQ(MX28, INT_GPMI, GPMI_NFC_GPMI_INTERRUPT_RES_NAME),
+	/* BCH */
+	RES_MEM(MX28, BCH_BASE_ADDR, SZ_8K, GPMI_NFC_BCH_REGS_ADDR_RES_NAME),
+	RES_IRQ(MX28, INT_BCH, GPMI_NFC_BCH_INTERRUPT_RES_NAME),
+	/* DMA */
+	RES_DMA(MX28, DMA_GPMI0, DMA_GPMI7, GPMI_NFC_DMA_CHANNELS_RES_NAME),
+	RES_IRQ(MX28, INT_GPMI_DMA, GPMI_NFC_DMA_INTERRUPT_RES_NAME),
+};
+#endif
+
+struct platform_device *__init
+mxs_add_gpmi(const struct gpmi_nfc_platform_data *data,
+		const struct resource *res, int res_size, const char *name)
+{
+	return mxs_add_platform_device_dmamask(name, -1,
+				res, res_size,
+				data, sizeof(*data), 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..8c8a487 100644
--- a/arch/arm/mach-mxs/include/mach/devices-common.h
+++ b/arch/arm/mach-mxs/include/mach/devices-common.h
@@ -64,6 +64,12 @@ struct platform_device *__init mxs_add_flexcan(
 		const struct mxs_flexcan_data *data,
 		const struct flexcan_platform_data *pdata);
 
+/* gpmi */
+#include <mach/gpmi-nfc.h>
+struct platform_device *__init
+mxs_add_gpmi(const struct gpmi_nfc_platform_data *data,
+		const struct resource *res, int res_size, const char *name);
+
 /* 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..9b808e1 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(&mx23evk_gpmi_pdata);
 	mx23_add_mxsfb(&mx23evk_mxsfb_pdata);
 }
 
diff --git a/arch/arm/mach-mxs/mach-mx28evk.c b/arch/arm/mach-mxs/mach-mx28evk.c
index 08002d0..8b165f8 100644
--- a/arch/arm/mach-mxs/mach-mx28evk.c
+++ b/arch/arm/mach-mxs/mach-mx28evk.c
@@ -82,6 +82,26 @@ static const iomux_cfg_t mx28evk_pads[] __initconst = {
 	/* transceiver power control */
 	MX28_PAD_SSP1_CMD__GPIO_2_13,
 
+#define MXS_PAD_GPMI	(MXS_PAD_12MA | MXS_PAD_3V3 | MXS_PAD_NOPULL)
+	/* gpmi */
+	MX28_PAD_GPMI_D00__GPMI_D0 | MXS_PAD_CTRL,
+	MX28_PAD_GPMI_D01__GPMI_D1 | MXS_PAD_CTRL,
+	MX28_PAD_GPMI_D02__GPMI_D2 | MXS_PAD_CTRL,
+	MX28_PAD_GPMI_D03__GPMI_D3 | MXS_PAD_CTRL,
+	MX28_PAD_GPMI_D04__GPMI_D4 | MXS_PAD_CTRL,
+	MX28_PAD_GPMI_D05__GPMI_D5 | MXS_PAD_CTRL,
+	MX28_PAD_GPMI_D06__GPMI_D6 | MXS_PAD_CTRL,
+	MX28_PAD_GPMI_D07__GPMI_D7 | MXS_PAD_CTRL,
+	MX28_PAD_GPMI_ALE__GPMI_ALE | MXS_PAD_CTRL,
+	MX28_PAD_GPMI_CLE__GPMI_CLE | MXS_PAD_CTRL,
+	MX28_PAD_GPMI_CE0N__GPMI_CE0N | MXS_PAD_CTRL,
+	MX28_PAD_GPMI_CE1N__GPMI_CE1N | MXS_PAD_CTRL,
+	MX28_PAD_GPMI_RDY0__GPMI_READY0 | MXS_PAD_CTRL,
+	MX28_PAD_GPMI_RDY1__GPMI_READY1 | MXS_PAD_CTRL,
+	MX28_PAD_GPMI_RDN__GPMI_RDN | MXS_PAD_GPMI,
+	MX28_PAD_GPMI_WRN__GPMI_WRN | MXS_PAD_GPMI,
+	MX28_PAD_GPMI_RESETN__GPMI_RESETN | MXS_PAD_GPMI,
+
 	/* mxsfb (lcdif) */
 	MX28_PAD_LCD_D00__LCD_D0 | MXS_PAD_CTRL,
 	MX28_PAD_LCD_D01__LCD_D1 | MXS_PAD_CTRL,
@@ -232,6 +252,13 @@ static const struct flexcan_platform_data
 	}
 };
 
+/* gpmi */
+static const struct gpmi_nfc_platform_data  mx28evk_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 mx28evk_video_modes[] = {
 	{
@@ -296,6 +323,7 @@ static void __init mx28evk_init(void)
 	else
 		gpio_set_value(MX28EVK_BL_ENABLE, 1);
 
+	mx28_add_gpmi(&mx28evk_gpmi_pdata);
 	mx28_add_mxsfb(&mx28evk_mxsfb_pdata);
 }
 
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/2] ARM: mxs: add GPMI support for imx23/imx28
  2011-04-15  8:01 ` Huang Shijie
@ 2011-04-15  8:06   ` Uwe Kleine-König
  -1 siblings, 0 replies; 16+ messages in thread
From: Uwe Kleine-König @ 2011-04-15  8:06 UTC (permalink / raw)
  To: Huang Shijie; +Cc: s.hauer, linux-mtd, linux-arm-kernel

On Fri, Apr 15, 2011 at 04:01:47PM +0800, Huang Shijie wrote:
> +#define GPMI_NFC_DRIVER_NAME	"gpmi-nfc"
> +#define GPMI_NFC_DRIVER_MX23	"imx23-gpmi-nfc"
> +#define GPMI_NFC_DRIVER_MX28	"imx28-gpmi-nfc"
> +#define GPMI_NFC_DRIVER_MX50	"imx50-gpmi-nfc"
Is it sensible to keep these when they are only used in a single .c
file?

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 1/2] ARM: mxs: add GPMI support for imx23/imx28
@ 2011-04-15  8:06   ` Uwe Kleine-König
  0 siblings, 0 replies; 16+ messages in thread
From: Uwe Kleine-König @ 2011-04-15  8:06 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Apr 15, 2011 at 04:01:47PM +0800, Huang Shijie wrote:
> +#define GPMI_NFC_DRIVER_NAME	"gpmi-nfc"
> +#define GPMI_NFC_DRIVER_MX23	"imx23-gpmi-nfc"
> +#define GPMI_NFC_DRIVER_MX28	"imx28-gpmi-nfc"
> +#define GPMI_NFC_DRIVER_MX50	"imx50-gpmi-nfc"
Is it sensible to keep these when they are only used in a single .c
file?

-- 
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/2] ARM: mxs: add GPMI device for imx23/imx28
  2011-04-15  8:01   ` Huang Shijie
@ 2011-04-15  8:12     ` Uwe Kleine-König
  -1 siblings, 0 replies; 16+ messages in thread
From: Uwe Kleine-König @ 2011-04-15  8:12 UTC (permalink / raw)
  To: Huang Shijie; +Cc: s.hauer, linux-mtd, linux-arm-kernel

On Fri, Apr 15, 2011 at 04:01:48PM +0800, Huang Shijie wrote:
> add the gpmi device for imx23 and imx28.
> 
> Signed-off-by: Huang Shijie <b32955@freescale.com>
> ---
>  arch/arm/mach-mxs/clock-mx23.c                  |    1 +
>  arch/arm/mach-mxs/clock-mx28.c                  |    1 +
>  arch/arm/mach-mxs/devices-mx23.h                |    4 +
>  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-gpmi.c       |   82 +++++++++++++++++++++++
>  arch/arm/mach-mxs/include/mach/devices-common.h |    6 ++
>  arch/arm/mach-mxs/mach-mx23evk.c                |   28 ++++++++
>  arch/arm/mach-mxs/mach-mx28evk.c                |   28 ++++++++
Can you please split out the changes to arch/arm/mach-mxs/mach-* into
one or two seperate changes?

>  10 files changed, 158 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/clock-mx28.c b/arch/arm/mach-mxs/clock-mx28.c
> index 5e489a2..9dbd2d5 100644
> --- a/arch/arm/mach-mxs/clock-mx28.c
> +++ b/arch/arm/mach-mxs/clock-mx28.c
> @@ -609,6 +609,7 @@ static struct clk_lookup lookups[] = {
>  	_REGISTER_CLOCK("duart", NULL, uart_clk)
>  	_REGISTER_CLOCK("imx28-fec.0", NULL, fec_clk)
>  	_REGISTER_CLOCK("imx28-fec.1", NULL, fec_clk)
> +	_REGISTER_CLOCK("imx28-gpmi-nfc", NULL, gpmi_clk)
>  	_REGISTER_CLOCK("mxs-auart.0", NULL, uart_clk)
>  	_REGISTER_CLOCK("mxs-auart.1", NULL, uart_clk)
>  	_REGISTER_CLOCK("mxs-auart.2", NULL, uart_clk)
> diff --git a/arch/arm/mach-mxs/devices-mx23.h b/arch/arm/mach-mxs/devices-mx23.h
> index c7e14f4..03bd234 100644
> --- a/arch/arm/mach-mxs/devices-mx23.h
> +++ b/arch/arm/mach-mxs/devices-mx23.h
> @@ -21,6 +21,10 @@ 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 resource res_imx23[RES_SIZE] __initconst;
This doesn't have a namespace, but see below.

> +#define mx23_add_gpmi(pdata)	\
> +	mxs_add_gpmi(pdata, res_imx23, RES_SIZE, GPMI_NFC_DRIVER_MX23)
The less arguments mxs_add_gpmi takes the easier it's to call it. (I.e.
the machine code to set the arguments and call the function is shorter
when there are only two arguments to pass.) See platform-spi_imx.c for
an example to pass a device id.

> +
>  #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-mx28.h b/arch/arm/mach-mxs/devices-mx28.h
> index 9d08555..64458fd 100644
> --- a/arch/arm/mach-mxs/devices-mx28.h
> +++ b/arch/arm/mach-mxs/devices-mx28.h
> @@ -34,6 +34,10 @@ extern const struct mxs_flexcan_data mx28_flexcan_data[] __initconst;
>  #define mx28_add_flexcan0(pdata)	mx28_add_flexcan(0, pdata)
>  #define mx28_add_flexcan1(pdata)	mx28_add_flexcan(1, pdata)
>  
> +extern const struct resource res_imx28[RES_SIZE] __initconst;
> +#define mx28_add_gpmi(pdata)	\
> +	mxs_add_gpmi(pdata, res_imx28, RES_SIZE, GPMI_NFC_DRIVER_MX28)
> +
ditto
>  extern const struct mxs_i2c_data mx28_mxs_i2c_data[] __initconst;
>  #define mx28_add_mxs_i2c(id)		mxs_add_mxs_i2c(&mx28_mxs_i2c_data[id])
>  
> diff --git a/arch/arm/mach-mxs/devices/Kconfig b/arch/arm/mach-mxs/devices/Kconfig
> index 1451ad0..e9a9a8b 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
> +	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..4f2f66c 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) += 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..46f5e52
> --- /dev/null
> +++ b/arch/arm/mach-mxs/devices/platform-gpmi.c
> @@ -0,0 +1,82 @@
> +/*
> + * 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 <asm/sizes.h>
> +#include <mach/mx23.h>
> +#include <mach/mx28.h>
> +#include <mach/devices-common.h>
> +
> +#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 resource res_imx23[RES_SIZE] __initconst = {
> +	/* 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
> +
> +#ifdef CONFIG_SOC_IMX28
> +const struct resource res_imx28[RES_SIZE] __initconst = {
> +	/* GPMI */
> +	RES_MEM(MX28, GPMI_BASE_ADDR, SZ_8K, GPMI_NFC_GPMI_REGS_ADDR_RES_NAME),
> +	RES_IRQ(MX28, INT_GPMI, GPMI_NFC_GPMI_INTERRUPT_RES_NAME),
> +	/* BCH */
> +	RES_MEM(MX28, BCH_BASE_ADDR, SZ_8K, GPMI_NFC_BCH_REGS_ADDR_RES_NAME),
> +	RES_IRQ(MX28, INT_BCH, GPMI_NFC_BCH_INTERRUPT_RES_NAME),
> +	/* DMA */
> +	RES_DMA(MX28, DMA_GPMI0, DMA_GPMI7, GPMI_NFC_DMA_CHANNELS_RES_NAME),
> +	RES_IRQ(MX28, INT_GPMI_DMA, GPMI_NFC_DMA_INTERRUPT_RES_NAME),
> +};
> +#endif
See how this is done in platform-spi_imx.c.

> +
> +struct platform_device *__init
> +mxs_add_gpmi(const struct gpmi_nfc_platform_data *data,
> +		const struct resource *res, int res_size, const char *name)
> +{
> +	return mxs_add_platform_device_dmamask(name, -1,
> +				res, res_size,
> +				data, sizeof(*data), DMA_BIT_MASK(32));
> +}
Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 2/2] ARM: mxs: add GPMI device for imx23/imx28
@ 2011-04-15  8:12     ` Uwe Kleine-König
  0 siblings, 0 replies; 16+ messages in thread
From: Uwe Kleine-König @ 2011-04-15  8:12 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Apr 15, 2011 at 04:01:48PM +0800, Huang Shijie wrote:
> add the gpmi device for imx23 and imx28.
> 
> Signed-off-by: Huang Shijie <b32955@freescale.com>
> ---
>  arch/arm/mach-mxs/clock-mx23.c                  |    1 +
>  arch/arm/mach-mxs/clock-mx28.c                  |    1 +
>  arch/arm/mach-mxs/devices-mx23.h                |    4 +
>  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-gpmi.c       |   82 +++++++++++++++++++++++
>  arch/arm/mach-mxs/include/mach/devices-common.h |    6 ++
>  arch/arm/mach-mxs/mach-mx23evk.c                |   28 ++++++++
>  arch/arm/mach-mxs/mach-mx28evk.c                |   28 ++++++++
Can you please split out the changes to arch/arm/mach-mxs/mach-* into
one or two seperate changes?

>  10 files changed, 158 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/clock-mx28.c b/arch/arm/mach-mxs/clock-mx28.c
> index 5e489a2..9dbd2d5 100644
> --- a/arch/arm/mach-mxs/clock-mx28.c
> +++ b/arch/arm/mach-mxs/clock-mx28.c
> @@ -609,6 +609,7 @@ static struct clk_lookup lookups[] = {
>  	_REGISTER_CLOCK("duart", NULL, uart_clk)
>  	_REGISTER_CLOCK("imx28-fec.0", NULL, fec_clk)
>  	_REGISTER_CLOCK("imx28-fec.1", NULL, fec_clk)
> +	_REGISTER_CLOCK("imx28-gpmi-nfc", NULL, gpmi_clk)
>  	_REGISTER_CLOCK("mxs-auart.0", NULL, uart_clk)
>  	_REGISTER_CLOCK("mxs-auart.1", NULL, uart_clk)
>  	_REGISTER_CLOCK("mxs-auart.2", NULL, uart_clk)
> diff --git a/arch/arm/mach-mxs/devices-mx23.h b/arch/arm/mach-mxs/devices-mx23.h
> index c7e14f4..03bd234 100644
> --- a/arch/arm/mach-mxs/devices-mx23.h
> +++ b/arch/arm/mach-mxs/devices-mx23.h
> @@ -21,6 +21,10 @@ 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 resource res_imx23[RES_SIZE] __initconst;
This doesn't have a namespace, but see below.

> +#define mx23_add_gpmi(pdata)	\
> +	mxs_add_gpmi(pdata, res_imx23, RES_SIZE, GPMI_NFC_DRIVER_MX23)
The less arguments mxs_add_gpmi takes the easier it's to call it. (I.e.
the machine code to set the arguments and call the function is shorter
when there are only two arguments to pass.) See platform-spi_imx.c for
an example to pass a device id.

> +
>  #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-mx28.h b/arch/arm/mach-mxs/devices-mx28.h
> index 9d08555..64458fd 100644
> --- a/arch/arm/mach-mxs/devices-mx28.h
> +++ b/arch/arm/mach-mxs/devices-mx28.h
> @@ -34,6 +34,10 @@ extern const struct mxs_flexcan_data mx28_flexcan_data[] __initconst;
>  #define mx28_add_flexcan0(pdata)	mx28_add_flexcan(0, pdata)
>  #define mx28_add_flexcan1(pdata)	mx28_add_flexcan(1, pdata)
>  
> +extern const struct resource res_imx28[RES_SIZE] __initconst;
> +#define mx28_add_gpmi(pdata)	\
> +	mxs_add_gpmi(pdata, res_imx28, RES_SIZE, GPMI_NFC_DRIVER_MX28)
> +
ditto
>  extern const struct mxs_i2c_data mx28_mxs_i2c_data[] __initconst;
>  #define mx28_add_mxs_i2c(id)		mxs_add_mxs_i2c(&mx28_mxs_i2c_data[id])
>  
> diff --git a/arch/arm/mach-mxs/devices/Kconfig b/arch/arm/mach-mxs/devices/Kconfig
> index 1451ad0..e9a9a8b 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
> +	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..4f2f66c 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) += 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..46f5e52
> --- /dev/null
> +++ b/arch/arm/mach-mxs/devices/platform-gpmi.c
> @@ -0,0 +1,82 @@
> +/*
> + * 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 <asm/sizes.h>
> +#include <mach/mx23.h>
> +#include <mach/mx28.h>
> +#include <mach/devices-common.h>
> +
> +#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 resource res_imx23[RES_SIZE] __initconst = {
> +	/* 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
> +
> +#ifdef CONFIG_SOC_IMX28
> +const struct resource res_imx28[RES_SIZE] __initconst = {
> +	/* GPMI */
> +	RES_MEM(MX28, GPMI_BASE_ADDR, SZ_8K, GPMI_NFC_GPMI_REGS_ADDR_RES_NAME),
> +	RES_IRQ(MX28, INT_GPMI, GPMI_NFC_GPMI_INTERRUPT_RES_NAME),
> +	/* BCH */
> +	RES_MEM(MX28, BCH_BASE_ADDR, SZ_8K, GPMI_NFC_BCH_REGS_ADDR_RES_NAME),
> +	RES_IRQ(MX28, INT_BCH, GPMI_NFC_BCH_INTERRUPT_RES_NAME),
> +	/* DMA */
> +	RES_DMA(MX28, DMA_GPMI0, DMA_GPMI7, GPMI_NFC_DMA_CHANNELS_RES_NAME),
> +	RES_IRQ(MX28, INT_GPMI_DMA, GPMI_NFC_DMA_INTERRUPT_RES_NAME),
> +};
> +#endif
See how this is done in platform-spi_imx.c.

> +
> +struct platform_device *__init
> +mxs_add_gpmi(const struct gpmi_nfc_platform_data *data,
> +		const struct resource *res, int res_size, const char *name)
> +{
> +	return mxs_add_platform_device_dmamask(name, -1,
> +				res, res_size,
> +				data, sizeof(*data), DMA_BIT_MASK(32));
> +}
Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/2] ARM: mxs: add GPMI support for imx23/imx28
  2011-04-15  8:06   ` Uwe Kleine-König
@ 2011-04-15  8:13     ` Huang Shijie
  -1 siblings, 0 replies; 16+ messages in thread
From: Huang Shijie @ 2011-04-15  8:13 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: s.hauer, linux-mtd, linux-arm-kernel

> On Fri, Apr 15, 2011 at 04:01:47PM +0800, Huang Shijie wrote:
>> +#define GPMI_NFC_DRIVER_NAME	"gpmi-nfc"
>> +#define GPMI_NFC_DRIVER_MX23	"imx23-gpmi-nfc"
>> +#define GPMI_NFC_DRIVER_MX28	"imx28-gpmi-nfc"
>> +#define GPMI_NFC_DRIVER_MX50	"imx50-gpmi-nfc"
> Is it sensible to keep these when they are only used in a single .c
> file?
>
I also use these in gpmi driver for distinguish platform id.
Do i have to remove these lines , and use the hardcode?

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 1/2] ARM: mxs: add GPMI support for imx23/imx28
@ 2011-04-15  8:13     ` Huang Shijie
  0 siblings, 0 replies; 16+ messages in thread
From: Huang Shijie @ 2011-04-15  8:13 UTC (permalink / raw)
  To: linux-arm-kernel

> On Fri, Apr 15, 2011 at 04:01:47PM +0800, Huang Shijie wrote:
>> +#define GPMI_NFC_DRIVER_NAME	"gpmi-nfc"
>> +#define GPMI_NFC_DRIVER_MX23	"imx23-gpmi-nfc"
>> +#define GPMI_NFC_DRIVER_MX28	"imx28-gpmi-nfc"
>> +#define GPMI_NFC_DRIVER_MX50	"imx50-gpmi-nfc"
> Is it sensible to keep these when they are only used in a single .c
> file?
>
I also use these in gpmi driver for distinguish platform id.
Do i have to remove these lines , and use the hardcode?

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/2] ARM: mxs: add GPMI device for imx23/imx28
  2011-04-15  8:12     ` Uwe Kleine-König
@ 2011-04-15  8:33       ` Huang Shijie
  -1 siblings, 0 replies; 16+ messages in thread
From: Huang Shijie @ 2011-04-15  8:33 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: s.hauer, linux-mtd, linux-arm-kernel

hi:
> On Fri, Apr 15, 2011 at 04:01:48PM +0800, Huang Shijie wrote:
>> add the gpmi device for imx23 and imx28.
>>
>> Signed-off-by: Huang Shijie<b32955@freescale.com>
>> ---
>>   arch/arm/mach-mxs/clock-mx23.c                  |    1 +
>>   arch/arm/mach-mxs/clock-mx28.c                  |    1 +
>>   arch/arm/mach-mxs/devices-mx23.h                |    4 +
>>   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-gpmi.c       |   82 +++++++++++++++++++++++
>>   arch/arm/mach-mxs/include/mach/devices-common.h |    6 ++
>>   arch/arm/mach-mxs/mach-mx23evk.c                |   28 ++++++++
>>   arch/arm/mach-mxs/mach-mx28evk.c                |   28 ++++++++
> Can you please split out the changes to arch/arm/mach-mxs/mach-* into
> one or two seperate changes?
>
ok, thanks.
>>   10 files changed, 158 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/clock-mx28.c b/arch/arm/mach-mxs/clock-mx28.c
>> index 5e489a2..9dbd2d5 100644
>> --- a/arch/arm/mach-mxs/clock-mx28.c
>> +++ b/arch/arm/mach-mxs/clock-mx28.c
>> @@ -609,6 +609,7 @@ static struct clk_lookup lookups[] = {
>>   	_REGISTER_CLOCK("duart", NULL, uart_clk)
>>   	_REGISTER_CLOCK("imx28-fec.0", NULL, fec_clk)
>>   	_REGISTER_CLOCK("imx28-fec.1", NULL, fec_clk)
>> +	_REGISTER_CLOCK("imx28-gpmi-nfc", NULL, gpmi_clk)
>>   	_REGISTER_CLOCK("mxs-auart.0", NULL, uart_clk)
>>   	_REGISTER_CLOCK("mxs-auart.1", NULL, uart_clk)
>>   	_REGISTER_CLOCK("mxs-auart.2", NULL, uart_clk)
>> diff --git a/arch/arm/mach-mxs/devices-mx23.h b/arch/arm/mach-mxs/devices-mx23.h
>> index c7e14f4..03bd234 100644
>> --- a/arch/arm/mach-mxs/devices-mx23.h
>> +++ b/arch/arm/mach-mxs/devices-mx23.h
>> @@ -21,6 +21,10 @@ 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 resource res_imx23[RES_SIZE] __initconst;
> This doesn't have a namespace, but see below.
>
>> +#define mx23_add_gpmi(pdata)	\
>> +	mxs_add_gpmi(pdata, res_imx23, RES_SIZE, GPMI_NFC_DRIVER_MX23)
> The less arguments mxs_add_gpmi takes the easier it's to call it. (I.e.
> the machine code to set the arguments and call the function is shorter
> when there are only two arguments to pass.) See platform-spi_imx.c for
> an example to pass a device id.
>
Ok. I will reduce the parameters to two.
>> +
>>   #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-mx28.h b/arch/arm/mach-mxs/devices-mx28.h
>> index 9d08555..64458fd 100644
>> --- a/arch/arm/mach-mxs/devices-mx28.h
>> +++ b/arch/arm/mach-mxs/devices-mx28.h
>> @@ -34,6 +34,10 @@ extern const struct mxs_flexcan_data mx28_flexcan_data[] __initconst;
>>   #define mx28_add_flexcan0(pdata)	mx28_add_flexcan(0, pdata)
>>   #define mx28_add_flexcan1(pdata)	mx28_add_flexcan(1, pdata)
>>
>> +extern const struct resource res_imx28[RES_SIZE] __initconst;
>> +#define mx28_add_gpmi(pdata)	\
>> +	mxs_add_gpmi(pdata, res_imx28, RES_SIZE, GPMI_NFC_DRIVER_MX28)
>> +
> ditto
>>   extern const struct mxs_i2c_data mx28_mxs_i2c_data[] __initconst;
>>   #define mx28_add_mxs_i2c(id)		mxs_add_mxs_i2c(&mx28_mxs_i2c_data[id])
>>
>> diff --git a/arch/arm/mach-mxs/devices/Kconfig b/arch/arm/mach-mxs/devices/Kconfig
>> index 1451ad0..e9a9a8b 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
>> +	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..4f2f66c 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) += 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..46f5e52
>> --- /dev/null
>> +++ b/arch/arm/mach-mxs/devices/platform-gpmi.c
>> @@ -0,0 +1,82 @@
>> +/*
>> + * 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<asm/sizes.h>
>> +#include<mach/mx23.h>
>> +#include<mach/mx28.h>
>> +#include<mach/devices-common.h>
>> +
>> +#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 resource res_imx23[RES_SIZE] __initconst = {
>> +	/* 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
>> +
>> +#ifdef CONFIG_SOC_IMX28
>> +const struct resource res_imx28[RES_SIZE] __initconst = {
>> +	/* GPMI */
>> +	RES_MEM(MX28, GPMI_BASE_ADDR, SZ_8K, GPMI_NFC_GPMI_REGS_ADDR_RES_NAME),
>> +	RES_IRQ(MX28, INT_GPMI, GPMI_NFC_GPMI_INTERRUPT_RES_NAME),
>> +	/* BCH */
>> +	RES_MEM(MX28, BCH_BASE_ADDR, SZ_8K, GPMI_NFC_BCH_REGS_ADDR_RES_NAME),
>> +	RES_IRQ(MX28, INT_BCH, GPMI_NFC_BCH_INTERRUPT_RES_NAME),
>> +	/* DMA */
>> +	RES_DMA(MX28, DMA_GPMI0, DMA_GPMI7, GPMI_NFC_DMA_CHANNELS_RES_NAME),
>> +	RES_IRQ(MX28, INT_GPMI_DMA, GPMI_NFC_DMA_INTERRUPT_RES_NAME),
>> +};
>> +#endif
> See how this is done in platform-spi_imx.c.
>
ok, thanks.

Best Regards
Huang Shijie
>> +
>> +struct platform_device *__init
>> +mxs_add_gpmi(const struct gpmi_nfc_platform_data *data,
>> +		const struct resource *res, int res_size, const char *name)
>> +{
>> +	return mxs_add_platform_device_dmamask(name, -1,
>> +				res, res_size,
>> +				data, sizeof(*data), DMA_BIT_MASK(32));
>> +}
> Best regards
> Uwe
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 2/2] ARM: mxs: add GPMI device for imx23/imx28
@ 2011-04-15  8:33       ` Huang Shijie
  0 siblings, 0 replies; 16+ messages in thread
From: Huang Shijie @ 2011-04-15  8:33 UTC (permalink / raw)
  To: linux-arm-kernel

hi:
> On Fri, Apr 15, 2011 at 04:01:48PM +0800, Huang Shijie wrote:
>> add the gpmi device for imx23 and imx28.
>>
>> Signed-off-by: Huang Shijie<b32955@freescale.com>
>> ---
>>   arch/arm/mach-mxs/clock-mx23.c                  |    1 +
>>   arch/arm/mach-mxs/clock-mx28.c                  |    1 +
>>   arch/arm/mach-mxs/devices-mx23.h                |    4 +
>>   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-gpmi.c       |   82 +++++++++++++++++++++++
>>   arch/arm/mach-mxs/include/mach/devices-common.h |    6 ++
>>   arch/arm/mach-mxs/mach-mx23evk.c                |   28 ++++++++
>>   arch/arm/mach-mxs/mach-mx28evk.c                |   28 ++++++++
> Can you please split out the changes to arch/arm/mach-mxs/mach-* into
> one or two seperate changes?
>
ok, thanks.
>>   10 files changed, 158 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/clock-mx28.c b/arch/arm/mach-mxs/clock-mx28.c
>> index 5e489a2..9dbd2d5 100644
>> --- a/arch/arm/mach-mxs/clock-mx28.c
>> +++ b/arch/arm/mach-mxs/clock-mx28.c
>> @@ -609,6 +609,7 @@ static struct clk_lookup lookups[] = {
>>   	_REGISTER_CLOCK("duart", NULL, uart_clk)
>>   	_REGISTER_CLOCK("imx28-fec.0", NULL, fec_clk)
>>   	_REGISTER_CLOCK("imx28-fec.1", NULL, fec_clk)
>> +	_REGISTER_CLOCK("imx28-gpmi-nfc", NULL, gpmi_clk)
>>   	_REGISTER_CLOCK("mxs-auart.0", NULL, uart_clk)
>>   	_REGISTER_CLOCK("mxs-auart.1", NULL, uart_clk)
>>   	_REGISTER_CLOCK("mxs-auart.2", NULL, uart_clk)
>> diff --git a/arch/arm/mach-mxs/devices-mx23.h b/arch/arm/mach-mxs/devices-mx23.h
>> index c7e14f4..03bd234 100644
>> --- a/arch/arm/mach-mxs/devices-mx23.h
>> +++ b/arch/arm/mach-mxs/devices-mx23.h
>> @@ -21,6 +21,10 @@ 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 resource res_imx23[RES_SIZE] __initconst;
> This doesn't have a namespace, but see below.
>
>> +#define mx23_add_gpmi(pdata)	\
>> +	mxs_add_gpmi(pdata, res_imx23, RES_SIZE, GPMI_NFC_DRIVER_MX23)
> The less arguments mxs_add_gpmi takes the easier it's to call it. (I.e.
> the machine code to set the arguments and call the function is shorter
> when there are only two arguments to pass.) See platform-spi_imx.c for
> an example to pass a device id.
>
Ok. I will reduce the parameters to two.
>> +
>>   #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-mx28.h b/arch/arm/mach-mxs/devices-mx28.h
>> index 9d08555..64458fd 100644
>> --- a/arch/arm/mach-mxs/devices-mx28.h
>> +++ b/arch/arm/mach-mxs/devices-mx28.h
>> @@ -34,6 +34,10 @@ extern const struct mxs_flexcan_data mx28_flexcan_data[] __initconst;
>>   #define mx28_add_flexcan0(pdata)	mx28_add_flexcan(0, pdata)
>>   #define mx28_add_flexcan1(pdata)	mx28_add_flexcan(1, pdata)
>>
>> +extern const struct resource res_imx28[RES_SIZE] __initconst;
>> +#define mx28_add_gpmi(pdata)	\
>> +	mxs_add_gpmi(pdata, res_imx28, RES_SIZE, GPMI_NFC_DRIVER_MX28)
>> +
> ditto
>>   extern const struct mxs_i2c_data mx28_mxs_i2c_data[] __initconst;
>>   #define mx28_add_mxs_i2c(id)		mxs_add_mxs_i2c(&mx28_mxs_i2c_data[id])
>>
>> diff --git a/arch/arm/mach-mxs/devices/Kconfig b/arch/arm/mach-mxs/devices/Kconfig
>> index 1451ad0..e9a9a8b 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
>> +	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..4f2f66c 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) += 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..46f5e52
>> --- /dev/null
>> +++ b/arch/arm/mach-mxs/devices/platform-gpmi.c
>> @@ -0,0 +1,82 @@
>> +/*
>> + * 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<asm/sizes.h>
>> +#include<mach/mx23.h>
>> +#include<mach/mx28.h>
>> +#include<mach/devices-common.h>
>> +
>> +#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 resource res_imx23[RES_SIZE] __initconst = {
>> +	/* 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
>> +
>> +#ifdef CONFIG_SOC_IMX28
>> +const struct resource res_imx28[RES_SIZE] __initconst = {
>> +	/* GPMI */
>> +	RES_MEM(MX28, GPMI_BASE_ADDR, SZ_8K, GPMI_NFC_GPMI_REGS_ADDR_RES_NAME),
>> +	RES_IRQ(MX28, INT_GPMI, GPMI_NFC_GPMI_INTERRUPT_RES_NAME),
>> +	/* BCH */
>> +	RES_MEM(MX28, BCH_BASE_ADDR, SZ_8K, GPMI_NFC_BCH_REGS_ADDR_RES_NAME),
>> +	RES_IRQ(MX28, INT_BCH, GPMI_NFC_BCH_INTERRUPT_RES_NAME),
>> +	/* DMA */
>> +	RES_DMA(MX28, DMA_GPMI0, DMA_GPMI7, GPMI_NFC_DMA_CHANNELS_RES_NAME),
>> +	RES_IRQ(MX28, INT_GPMI_DMA, GPMI_NFC_DMA_INTERRUPT_RES_NAME),
>> +};
>> +#endif
> See how this is done in platform-spi_imx.c.
>
ok, thanks.

Best Regards
Huang Shijie
>> +
>> +struct platform_device *__init
>> +mxs_add_gpmi(const struct gpmi_nfc_platform_data *data,
>> +		const struct resource *res, int res_size, const char *name)
>> +{
>> +	return mxs_add_platform_device_dmamask(name, -1,
>> +				res, res_size,
>> +				data, sizeof(*data), DMA_BIT_MASK(32));
>> +}
> Best regards
> Uwe
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/2] ARM: mxs: add GPMI support for imx23/imx28
  2011-04-15  8:13     ` Huang Shijie
@ 2011-04-15  8:42       ` Uwe Kleine-König
  -1 siblings, 0 replies; 16+ messages in thread
From: Uwe Kleine-König @ 2011-04-15  8:42 UTC (permalink / raw)
  To: Huang Shijie; +Cc: s.hauer, linux-mtd, linux-arm-kernel

On Fri, Apr 15, 2011 at 04:13:43PM +0800, Huang Shijie wrote:
> >On Fri, Apr 15, 2011 at 04:01:47PM +0800, Huang Shijie wrote:
> >>+#define GPMI_NFC_DRIVER_NAME	"gpmi-nfc"
> >>+#define GPMI_NFC_DRIVER_MX23	"imx23-gpmi-nfc"
> >>+#define GPMI_NFC_DRIVER_MX28	"imx28-gpmi-nfc"
> >>+#define GPMI_NFC_DRIVER_MX50	"imx50-gpmi-nfc"
> >Is it sensible to keep these when they are only used in a single .c
> >file?
> >
> I also use these in gpmi driver for distinguish platform id.
> Do i have to remove these lines , and use the hardcode?
Ah, I missed the usage in the header. *shrug*, I don't care much, but
I'd use hardcoding.

BTW, as the driver name is gpmi-nfc this should be used for the various
names introduced in this patch set. (i.e. mx28_add_gpmi_nfc,
MXS_HAS_PLATFORM_GPMI_NFC etc.)

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 1/2] ARM: mxs: add GPMI support for imx23/imx28
@ 2011-04-15  8:42       ` Uwe Kleine-König
  0 siblings, 0 replies; 16+ messages in thread
From: Uwe Kleine-König @ 2011-04-15  8:42 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Apr 15, 2011 at 04:13:43PM +0800, Huang Shijie wrote:
> >On Fri, Apr 15, 2011 at 04:01:47PM +0800, Huang Shijie wrote:
> >>+#define GPMI_NFC_DRIVER_NAME	"gpmi-nfc"
> >>+#define GPMI_NFC_DRIVER_MX23	"imx23-gpmi-nfc"
> >>+#define GPMI_NFC_DRIVER_MX28	"imx28-gpmi-nfc"
> >>+#define GPMI_NFC_DRIVER_MX50	"imx50-gpmi-nfc"
> >Is it sensible to keep these when they are only used in a single .c
> >file?
> >
> I also use these in gpmi driver for distinguish platform id.
> Do i have to remove these lines , and use the hardcode?
Ah, I missed the usage in the header. *shrug*, I don't care much, but
I'd use hardcoding.

BTW, as the driver name is gpmi-nfc this should be used for the various
names introduced in this patch set. (i.e. mx28_add_gpmi_nfc,
MXS_HAS_PLATFORM_GPMI_NFC etc.)

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/2] ARM: mxs: add GPMI support for imx23/imx28
  2011-04-15  8:42       ` Uwe Kleine-König
@ 2011-04-15  8:50         ` Huang Shijie
  -1 siblings, 0 replies; 16+ messages in thread
From: Huang Shijie @ 2011-04-15  8:50 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: s.hauer, linux-mtd, linux-arm-kernel

hi,
> On Fri, Apr 15, 2011 at 04:13:43PM +0800, Huang Shijie wrote:
>>> On Fri, Apr 15, 2011 at 04:01:47PM +0800, Huang Shijie wrote:
>>>> +#define GPMI_NFC_DRIVER_NAME	"gpmi-nfc"
>>>> +#define GPMI_NFC_DRIVER_MX23	"imx23-gpmi-nfc"
>>>> +#define GPMI_NFC_DRIVER_MX28	"imx28-gpmi-nfc"
>>>> +#define GPMI_NFC_DRIVER_MX50	"imx50-gpmi-nfc"
>>> Is it sensible to keep these when they are only used in a single .c
>>> file?
>>>
>> I also use these in gpmi driver for distinguish platform id.
>> Do i have to remove these lines , and use the hardcode?
> Ah, I missed the usage in the header. *shrug*, I don't care much, but
> I'd use hardcoding.
>
ok. I will change it in the next version.

> BTW, as the driver name is gpmi-nfc this should be used for the various
> names introduced in this patch set. (i.e. mx28_add_gpmi_nfc,
> MXS_HAS_PLATFORM_GPMI_NFC etc.)
thanks.

Best Regards
Huang Shijie
> Best regards
> Uwe
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 1/2] ARM: mxs: add GPMI support for imx23/imx28
@ 2011-04-15  8:50         ` Huang Shijie
  0 siblings, 0 replies; 16+ messages in thread
From: Huang Shijie @ 2011-04-15  8:50 UTC (permalink / raw)
  To: linux-arm-kernel

hi,
> On Fri, Apr 15, 2011 at 04:13:43PM +0800, Huang Shijie wrote:
>>> On Fri, Apr 15, 2011 at 04:01:47PM +0800, Huang Shijie wrote:
>>>> +#define GPMI_NFC_DRIVER_NAME	"gpmi-nfc"
>>>> +#define GPMI_NFC_DRIVER_MX23	"imx23-gpmi-nfc"
>>>> +#define GPMI_NFC_DRIVER_MX28	"imx28-gpmi-nfc"
>>>> +#define GPMI_NFC_DRIVER_MX50	"imx50-gpmi-nfc"
>>> Is it sensible to keep these when they are only used in a single .c
>>> file?
>>>
>> I also use these in gpmi driver for distinguish platform id.
>> Do i have to remove these lines , and use the hardcode?
> Ah, I missed the usage in the header. *shrug*, I don't care much, but
> I'd use hardcoding.
>
ok. I will change it in the next version.

> BTW, as the driver name is gpmi-nfc this should be used for the various
> names introduced in this patch set. (i.e. mx28_add_gpmi_nfc,
> MXS_HAS_PLATFORM_GPMI_NFC etc.)
thanks.

Best Regards
Huang Shijie
> Best regards
> Uwe
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2011-04-15  8:50 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-15  8:01 [PATCH 1/2] ARM: mxs: add GPMI support for imx23/imx28 Huang Shijie
2011-04-15  8:01 ` Huang Shijie
2011-04-15  8:01 ` [PATCH 2/2] ARM: mxs: add GPMI device " Huang Shijie
2011-04-15  8:01   ` Huang Shijie
2011-04-15  8:12   ` Uwe Kleine-König
2011-04-15  8:12     ` Uwe Kleine-König
2011-04-15  8:33     ` Huang Shijie
2011-04-15  8:33       ` Huang Shijie
2011-04-15  8:06 ` [PATCH 1/2] ARM: mxs: add GPMI support " Uwe Kleine-König
2011-04-15  8:06   ` Uwe Kleine-König
2011-04-15  8:13   ` Huang Shijie
2011-04-15  8:13     ` Huang Shijie
2011-04-15  8:42     ` Uwe Kleine-König
2011-04-15  8:42       ` Uwe Kleine-König
2011-04-15  8:50       ` Huang Shijie
2011-04-15  8:50         ` Huang Shijie

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.