All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] mach-mxs: dynamic device creation for i.MX28-i2c
@ 2011-02-18 17:18 Wolfram Sang
  2011-02-18 17:18 ` [PATCH 1/2] arm: mx23: names of interrupts and base address should match for I2C Wolfram Sang
  2011-02-18 17:18 ` [PATCH 2/2] arm: mxs: add i2c-devices Wolfram Sang
  0 siblings, 2 replies; 5+ messages in thread
From: Wolfram Sang @ 2011-02-18 17:18 UTC (permalink / raw)
  To: linux-arm-kernel

Currently for mx28 only, because the driver submitted for mainline does only
PIOQUEUE which is only available on that cpu. mx23 can be added if support is
available.

Patches are based on imx-for-2.6.39.

Wolfram Sang (2):
  arm: mx23: names of interrupts and base address should match for I2C
  arm: mxs: add i2c-devices

 arch/arm/mach-mxs/devices-mx28.h                |    3 +
 arch/arm/mach-mxs/devices/Kconfig               |    3 +
 arch/arm/mach-mxs/devices/Makefile              |    1 +
 arch/arm/mach-mxs/devices/platform-i2c.c        |   56 +++++++++++++++++++++++
 arch/arm/mach-mxs/include/mach/devices-common.h |    9 ++++
 arch/arm/mach-mxs/include/mach/mx23.h           |    2 +-
 6 files changed, 73 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/mach-mxs/devices/platform-i2c.c

-- 
1.7.2.3

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

* [PATCH 1/2] arm: mx23: names of interrupts and base address should match for I2C
  2011-02-18 17:18 [PATCH 0/2] mach-mxs: dynamic device creation for i.MX28-i2c Wolfram Sang
@ 2011-02-18 17:18 ` Wolfram Sang
  2011-02-18 17:18 ` [PATCH 2/2] arm: mxs: add i2c-devices Wolfram Sang
  1 sibling, 0 replies; 5+ messages in thread
From: Wolfram Sang @ 2011-02-18 17:18 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/mach-mxs/include/mach/mx23.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-mxs/include/mach/mx23.h b/arch/arm/mach-mxs/include/mach/mx23.h
index 4768402..9b610b1 100644
--- a/arch/arm/mach-mxs/include/mach/mx23.h
+++ b/arch/arm/mach-mxs/include/mach/mx23.h
@@ -57,7 +57,7 @@
 #define MX23_AUDIOIN_BASE_ADDR		(MX23_IO_BASE_ADDR + 0x04c000)
 #define MX23_LRADC_BASE_ADDR		(MX23_IO_BASE_ADDR + 0x050000)
 #define MX23_SPDIF_BASE_ADDR		(MX23_IO_BASE_ADDR + 0x054000)
-#define MX23_I2C0_BASE_ADDR		(MX23_IO_BASE_ADDR + 0x058000)
+#define MX23_I2C_BASE_ADDR		(MX23_IO_BASE_ADDR + 0x058000)
 #define MX23_RTC_BASE_ADDR		(MX23_IO_BASE_ADDR + 0x05c000)
 #define MX23_PWM_BASE_ADDR		(MX23_IO_BASE_ADDR + 0x064000)
 #define MX23_TIMROT_BASE_ADDR		(MX23_IO_BASE_ADDR + 0x068000)
-- 
1.7.2.3

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

* [PATCH 2/2] arm: mxs: add i2c-devices
  2011-02-18 17:18 [PATCH 0/2] mach-mxs: dynamic device creation for i.MX28-i2c Wolfram Sang
  2011-02-18 17:18 ` [PATCH 1/2] arm: mx23: names of interrupts and base address should match for I2C Wolfram Sang
@ 2011-02-18 17:18 ` Wolfram Sang
  2011-02-18 21:16   ` Uwe Kleine-König
  1 sibling, 1 reply; 5+ messages in thread
From: Wolfram Sang @ 2011-02-18 17:18 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/mach-mxs/devices-mx28.h                |    3 +
 arch/arm/mach-mxs/devices/Kconfig               |    3 +
 arch/arm/mach-mxs/devices/Makefile              |    1 +
 arch/arm/mach-mxs/devices/platform-i2c.c        |   56 +++++++++++++++++++++++
 arch/arm/mach-mxs/include/mach/devices-common.h |    9 ++++
 5 files changed, 72 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-mxs/devices/platform-i2c.c

diff --git a/arch/arm/mach-mxs/devices-mx28.h b/arch/arm/mach-mxs/devices-mx28.h
index 3b18304..c581b26 100644
--- a/arch/arm/mach-mxs/devices-mx28.h
+++ b/arch/arm/mach-mxs/devices-mx28.h
@@ -32,3 +32,6 @@ extern const struct mxs_flexcan_data mx28_flexcan_data[] __initconst;
 	mxs_add_flexcan(&mx28_flexcan_data[id], pdata)
 #define mx28_add_flexcan0(pdata)	mx28_add_flexcan(0, pdata)
 #define mx28_add_flexcan1(pdata)	mx28_add_flexcan(1, pdata)
+
+extern const struct mxs_i2c_data mx28_i2c_data[] __initconst;
+#define mx28_add_i2c(id)	mxs_add_i2c(&mx28_i2c_data[id])
diff --git a/arch/arm/mach-mxs/devices/Kconfig b/arch/arm/mach-mxs/devices/Kconfig
index 6c65b67..c9f80e1 100644
--- a/arch/arm/mach-mxs/devices/Kconfig
+++ b/arch/arm/mach-mxs/devices/Kconfig
@@ -11,3 +11,6 @@ config MXS_HAVE_PLATFORM_FEC
 config MXS_HAVE_PLATFORM_FLEXCAN
 	select HAVE_CAN_FLEXCAN if CAN
 	bool
+
+config MXS_HAVE_PLATFORM_I2C
+	bool
diff --git a/arch/arm/mach-mxs/devices/Makefile b/arch/arm/mach-mxs/devices/Makefile
index a8dc8d5..4fb4d9a 100644
--- a/arch/arm/mach-mxs/devices/Makefile
+++ b/arch/arm/mach-mxs/devices/Makefile
@@ -2,3 +2,4 @@ obj-$(CONFIG_MXS_HAVE_AMBA_DUART) += amba-duart.o
 obj-$(CONFIG_MXS_HAVE_PLATFORM_AUART) += platform-auart.o
 obj-$(CONFIG_MXS_HAVE_PLATFORM_FEC) += platform-fec.o
 obj-$(CONFIG_MXS_HAVE_PLATFORM_FLEXCAN) += platform-flexcan.o
+obj-$(CONFIG_MXS_HAVE_PLATFORM_I2C) += platform-i2c.o
diff --git a/arch/arm/mach-mxs/devices/platform-i2c.c b/arch/arm/mach-mxs/devices/platform-i2c.c
new file mode 100644
index 0000000..22236b2
--- /dev/null
+++ b/arch/arm/mach-mxs/devices/platform-i2c.c
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2011 Pengutronix
+ * Wolfram Sang <w.sang@pengutronix.de>
+ *
+ * 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 <asm/sizes.h>
+#include <mach/mx28.h>
+#include <mach/devices-common.h>
+
+/* helper defines to fix MX23 naming anomaly */
+#define MX23_I2C0_BASE_ADDR	MX23_I2C_BASE_ADDR
+#define MX23_INT_I2C0_ERROR	MX23_INT_I2C_ERROR
+#define MX23_INT_I2C0_DMA	MX23_INT_I2C_DMA
+
+#define mxs_i2c_data_entry_single(soc, _id)				\
+	{								\
+		.id = _id,						\
+		.iobase = soc ## _I2C ## _id ## _BASE_ADDR,		\
+		.errirq = soc ## _INT_I2C ## _id ## _ERROR,		\
+		.dmairq = soc ## _INT_I2C ## _id ## _DMA,		\
+	}
+
+#define mxs_i2c_data_entry(soc, _id)					\
+	[_id] = mxs_i2c_data_entry_single(soc, _id)
+
+#ifdef CONFIG_SOC_IMX28
+const struct mxs_i2c_data mx28_i2c_data[] __initconst = {
+	mxs_i2c_data_entry(MX28, 0),
+	mxs_i2c_data_entry(MX28, 1),
+};
+#endif
+
+struct platform_device *__init mxs_add_i2c(const struct mxs_i2c_data *data)
+{
+	struct resource res[] = {
+		{
+			.start = data->iobase,
+			.end = data->iobase + SZ_8K - 1,
+			.flags = IORESOURCE_MEM,
+		}, {
+			.start = data->errirq,
+			.end = data->errirq,
+			.flags = IORESOURCE_IRQ,
+		}, {
+			.start = data->dmairq,
+			.end = data->dmairq,
+			.flags = IORESOURCE_IRQ,
+		},
+	};
+
+	return mxs_add_platform_device("mxs-i2c", 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 e7aefb4..e385ece 100644
--- a/arch/arm/mach-mxs/include/mach/devices-common.h
+++ b/arch/arm/mach-mxs/include/mach/devices-common.h
@@ -63,3 +63,12 @@ struct mxs_flexcan_data {
 struct platform_device *__init mxs_add_flexcan(
 		const struct mxs_flexcan_data *data,
 		const struct flexcan_platform_data *pdata);
+
+/* i2c */
+struct mxs_i2c_data {
+	int id;
+	resource_size_t iobase;
+	resource_size_t errirq;
+	resource_size_t dmairq;
+};
+struct platform_device * __init mxs_add_i2c(const struct mxs_i2c_data *data);
-- 
1.7.2.3

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

* [PATCH 2/2] arm: mxs: add i2c-devices
  2011-02-18 17:18 ` [PATCH 2/2] arm: mxs: add i2c-devices Wolfram Sang
@ 2011-02-18 21:16   ` Uwe Kleine-König
  2011-02-22  7:30     ` Shawn Guo
  0 siblings, 1 reply; 5+ messages in thread
From: Uwe Kleine-König @ 2011-02-18 21:16 UTC (permalink / raw)
  To: linux-arm-kernel

Hello Wolfram,

On Fri, Feb 18, 2011 at 06:18:27PM +0100, Wolfram Sang wrote:
> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> ---
>  arch/arm/mach-mxs/devices-mx28.h                |    3 +
>  arch/arm/mach-mxs/devices/Kconfig               |    3 +
>  arch/arm/mach-mxs/devices/Makefile              |    1 +
>  arch/arm/mach-mxs/devices/platform-i2c.c        |   56 +++++++++++++++++++++++
>  arch/arm/mach-mxs/include/mach/devices-common.h |    9 ++++
>  5 files changed, 72 insertions(+), 0 deletions(-)
>  create mode 100644 arch/arm/mach-mxs/devices/platform-i2c.c
> 
> diff --git a/arch/arm/mach-mxs/devices-mx28.h b/arch/arm/mach-mxs/devices-mx28.h
> index 3b18304..c581b26 100644
> --- a/arch/arm/mach-mxs/devices-mx28.h
> +++ b/arch/arm/mach-mxs/devices-mx28.h
> @@ -32,3 +32,6 @@ extern const struct mxs_flexcan_data mx28_flexcan_data[] __initconst;
>  	mxs_add_flexcan(&mx28_flexcan_data[id], pdata)
>  #define mx28_add_flexcan0(pdata)	mx28_add_flexcan(0, pdata)
>  #define mx28_add_flexcan1(pdata)	mx28_add_flexcan(1, pdata)
> +
> +extern const struct mxs_i2c_data mx28_i2c_data[] __initconst;
> +#define mx28_add_i2c(id)	mxs_add_i2c(&mx28_i2c_data[id])
I'd like to have these named "mx28_mxs_i2c_data" to have the driver name
in the struct.  (And by the way I already fixed that for you even before
you sent out that patch :-)

> diff --git a/arch/arm/mach-mxs/devices/Kconfig b/arch/arm/mach-mxs/devices/Kconfig
> index 6c65b67..c9f80e1 100644
> --- a/arch/arm/mach-mxs/devices/Kconfig
> +++ b/arch/arm/mach-mxs/devices/Kconfig
> @@ -11,3 +11,6 @@ config MXS_HAVE_PLATFORM_FEC
>  config MXS_HAVE_PLATFORM_FLEXCAN
>  	select HAVE_CAN_FLEXCAN if CAN
>  	bool
> +
> +config MXS_HAVE_PLATFORM_I2C
> +	bool
> diff --git a/arch/arm/mach-mxs/devices/Makefile b/arch/arm/mach-mxs/devices/Makefile
> index a8dc8d5..4fb4d9a 100644
> --- a/arch/arm/mach-mxs/devices/Makefile
> +++ b/arch/arm/mach-mxs/devices/Makefile
> @@ -2,3 +2,4 @@ obj-$(CONFIG_MXS_HAVE_AMBA_DUART) += amba-duart.o
>  obj-$(CONFIG_MXS_HAVE_PLATFORM_AUART) += platform-auart.o
>  obj-$(CONFIG_MXS_HAVE_PLATFORM_FEC) += platform-fec.o
>  obj-$(CONFIG_MXS_HAVE_PLATFORM_FLEXCAN) += platform-flexcan.o
> +obj-$(CONFIG_MXS_HAVE_PLATFORM_I2C) += platform-i2c.o
ditto

> diff --git a/arch/arm/mach-mxs/devices/platform-i2c.c b/arch/arm/mach-mxs/devices/platform-i2c.c
> new file mode 100644
> index 0000000..22236b2
> --- /dev/null
> +++ b/arch/arm/mach-mxs/devices/platform-i2c.c
> @@ -0,0 +1,56 @@
> +/*
> + * Copyright (C) 2011 Pengutronix
> + * Wolfram Sang <w.sang@pengutronix.de>
> + *
> + * 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 <asm/sizes.h>
> +#include <mach/mx28.h>
> +#include <mach/devices-common.h>
> +
> +/* helper defines to fix MX23 naming anomaly */
> +#define MX23_I2C0_BASE_ADDR	MX23_I2C_BASE_ADDR
> +#define MX23_INT_I2C0_ERROR	MX23_INT_I2C_ERROR
> +#define MX23_INT_I2C0_DMA	MX23_INT_I2C_DMA
not needed yet, but OK

> +
> +#define mxs_i2c_data_entry_single(soc, _id)				\
> +	{								\
> +		.id = _id,						\
> +		.iobase = soc ## _I2C ## _id ## _BASE_ADDR,		\
> +		.errirq = soc ## _INT_I2C ## _id ## _ERROR,		\
> +		.dmairq = soc ## _INT_I2C ## _id ## _DMA,		\
> +	}
> +
> +#define mxs_i2c_data_entry(soc, _id)					\
> +	[_id] = mxs_i2c_data_entry_single(soc, _id)
add here an addional mxs, too.  (Thought I don't care that much here)

> +
> +#ifdef CONFIG_SOC_IMX28
> +const struct mxs_i2c_data mx28_i2c_data[] __initconst = {
> +	mxs_i2c_data_entry(MX28, 0),
> +	mxs_i2c_data_entry(MX28, 1),
> +};
> +#endif
> +
> +struct platform_device *__init mxs_add_i2c(const struct mxs_i2c_data *data)
> +{
> +	struct resource res[] = {
> +		{
> +			.start = data->iobase,
> +			.end = data->iobase + SZ_8K - 1,
> +			.flags = IORESOURCE_MEM,
> +		}, {
> +			.start = data->errirq,
> +			.end = data->errirq,
> +			.flags = IORESOURCE_IRQ,
> +		}, {
> +			.start = data->dmairq,
> +			.end = data->dmairq,
> +			.flags = IORESOURCE_IRQ,
> +		},
> +	};
> +
> +	return mxs_add_platform_device("mxs-i2c", 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 e7aefb4..e385ece 100644
> --- a/arch/arm/mach-mxs/include/mach/devices-common.h
> +++ b/arch/arm/mach-mxs/include/mach/devices-common.h
> @@ -63,3 +63,12 @@ struct mxs_flexcan_data {
>  struct platform_device *__init mxs_add_flexcan(
>  		const struct mxs_flexcan_data *data,
>  		const struct flexcan_platform_data *pdata);
> +
> +/* i2c */
> +struct mxs_i2c_data {
> +	int id;
> +	resource_size_t iobase;
> +	resource_size_t errirq;
> +	resource_size_t dmairq;
> +};
> +struct platform_device * __init mxs_add_i2c(const struct mxs_i2c_data *data);

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

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

* [PATCH 2/2] arm: mxs: add i2c-devices
  2011-02-18 21:16   ` Uwe Kleine-König
@ 2011-02-22  7:30     ` Shawn Guo
  0 siblings, 0 replies; 5+ messages in thread
From: Shawn Guo @ 2011-02-22  7:30 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Feb 18, 2011 at 10:16:18PM +0100, Uwe Kleine-K?nig wrote:
> 
> > diff --git a/arch/arm/mach-mxs/devices/platform-i2c.c b/arch/arm/mach-mxs/devices/platform-i2c.c
> > new file mode 100644
> > index 0000000..22236b2
> > --- /dev/null
> > +++ b/arch/arm/mach-mxs/devices/platform-i2c.c
> > @@ -0,0 +1,56 @@
> > +/*
> > + * Copyright (C) 2011 Pengutronix
> > + * Wolfram Sang <w.sang@pengutronix.de>
> > + *
> > + * 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 <asm/sizes.h>
> > +#include <mach/mx28.h>
> > +#include <mach/devices-common.h>
> > +
> > +/* helper defines to fix MX23 naming anomaly */
> > +#define MX23_I2C0_BASE_ADDR	MX23_I2C_BASE_ADDR
> > +#define MX23_INT_I2C0_ERROR	MX23_INT_I2C_ERROR
> > +#define MX23_INT_I2C0_DMA	MX23_INT_I2C_DMA
> not needed yet, but OK
> 
It makes less sense to me to have these without including mx23.h.

-- 
Regards,
Shawn

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

end of thread, other threads:[~2011-02-22  7:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-18 17:18 [PATCH 0/2] mach-mxs: dynamic device creation for i.MX28-i2c Wolfram Sang
2011-02-18 17:18 ` [PATCH 1/2] arm: mx23: names of interrupts and base address should match for I2C Wolfram Sang
2011-02-18 17:18 ` [PATCH 2/2] arm: mxs: add i2c-devices Wolfram Sang
2011-02-18 21:16   ` Uwe Kleine-König
2011-02-22  7:30     ` Shawn Guo

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.