Skip to contentSkip to conversation

add an i2c driver for mx31

PATCH New Guennadi Liakhovetski 6 participants 11 messages Mar 26, 2008 – Apr 15, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 3/7 add an i2c driver for mx31

From: Sascha Hauer <[email protected]>

This patch adds an i2c driver for Freescale i.MX processors

---

No changes wrt v1

 drivers/i2c/Makefile  |    1 +
 drivers/i2c/mxc_i2c.c |  202 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 203 insertions(+), 0 deletions(-)
 create mode 100644 drivers/i2c/mxc_i2c.c
drivers/i2c/Makefile +1 -0
index 29d6c03..071ef00 100644
@@ -29,6 +29,7 @@ COBJS-y += fsl_i2c.o
 COBJS-y += omap1510_i2c.o
 COBJS-y += omap24xx_i2c.o
 COBJS-y += tsi108_i2c.o
+COBJS-y += mxc_i2c.o
 
 COBJS	:= $(COBJS-y)
 SRCS 	:= $(COBJS:.o=.c)
drivers/i2c/mxc_i2c.c new file +202 -0

202 lines not on this page · raw message

Signature · 1 line
1.5.4
#1 lore raw

PATCH v2 3/7 add an i2c driver for mx31

Quoted 6 lines · In message <[email protected]> you wrote:

From: Sascha Hauer <[email protected]>

This patch adds an i2c driver for Freescale i.MX processors

Pulled in directly, thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"We Americans, we're a simple people... but piss us  off,  and  we'll
bomb your cities."           - Robin Williams, _Good Morning Vietnam_
#2 lore raw

PATCH v2 3/7 add an i2c driver for mx31

In reply to Guennadi Liakhovetski
Quoted 51 lines · Guennadi Liakhovetski

From: Sascha Hauer <[email protected]>

This patch adds an i2c driver for Freescale i.MX processors

---

No changes wrt v1

 drivers/i2c/Makefile  |    1 +
 drivers/i2c/mxc_i2c.c |  202 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 203 insertions(+), 0 deletions(-)
 create mode 100644 drivers/i2c/mxc_i2c.c
drivers/i2c/Makefile +1 -0
index 29d6c03..071ef00 100644
@@ -29,6 +29,7 @@ COBJS-y += fsl_i2c.o
 COBJS-y += omap1510_i2c.o
 COBJS-y += omap24xx_i2c.o
 COBJS-y += tsi108_i2c.o
+COBJS-y += mxc_i2c.o
 
 COBJS	:= $(COBJS-y)
 SRCS 	:= $(COBJS:.o=.c)
drivers/i2c/mxc_i2c.c new file +17 -0
new file mode 100644
index 0000000..a218329
@@ -0,0 +1,202 @@
+/*
+ * i2c driver for Freescale mx31
+ *
+ * (c) 2007 Pengutronix, Sascha Hauer <[email protected]>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * 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.

drivers/i2c/mxc_i2c.c line 27

Quoted 10 lines
drivers/i2c/mxc_i2c.c new file +10 -0
+ *
+ * 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., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+
+#if defined(CONFIG_HARD_I2C) && defined (CONFIG_I2C_MXC)

Please stop to define this here, move it the Makefile

Wolfgang,
Is it possible to NACK all patch that add new driver that do this

Best Regards,
J.

#3 lore raw

PATCH v2 3/7 add an i2c driver for mx31

Quoted 65 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 52 lines · Guennadi Liakhovetski

From: Sascha Hauer <[email protected]>

This patch adds an i2c driver for Freescale i.MX processors

---

No changes wrt v1

drivers/i2c/Makefile | 1 +
drivers/i2c/mxc_i2c.c | 202 +++++++++++++++++++++++++++++++++++++++
++++++++++

2 files changed, 203 insertions(+), 0 deletions(-)

create mode 100644 drivers/i2c/mxc_i2c.c

drivers/i2c/Makefile +0 -0
index 29d6c03..071ef00 100644
@@ -29,6 +29,7 @@ COBJS-y += fsl_i2c.o

COBJS-y += omap1510_i2c.o
COBJS-y += omap24xx_i2c.o
COBJS-y += tsi108_i2c.o
+COBJS-y += mxc_i2c.o

COBJS := $(COBJS-y)
SRCS := $(COBJS:.o=.c)

drivers/i2c/mxc_i2c.c new file +17 -0
new file mode 100644
index 0000000..a218329
@@ -0,0 +1,202 @@
+/*
+ * i2c driver for Freescale mx31
+ *
+ * (c) 2007 Pengutronix, Sascha Hauer <[email protected]>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * 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.

drivers/i2c/mxc_i2c.c line 27

Quoted 10 lines
drivers/i2c/mxc_i2c.c new file +10 -0
+ *
+ * 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., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+
+#if defined(CONFIG_HARD_I2C) && defined (CONFIG_I2C_MXC)

Please stop to define this here, move it the Makefile

Quoted 2 lines

Wolfgang,
Is it possible to NACK all patch that add new driver that do this

Also, I believe the imx I2C is the same as the PPC I2C HW. I havent verified this but the register set looks oddly identical.

- k

#4 lore raw

PATCH v2 3/7 add an i2c driver for mx31

In reply to Jean-Christophe PLAGNIOL-VILLARD
Quoted 3 lines · In message <[email protected]> you wrote:
Quoted 2 lines

+#if defined(CONFIG_HARD_I2C) && defined (CONFIG_I2C_MXC)

Please stop to define this here, move it the Makefile

Hm... While I agree with the simple standard case of a single "#ifdef", I'm not so 100% sure it is a good thing to add such complex expressions to the Makefile.

Aren't we just moving the #ifdef hell from one place to another?

Quoted 2 lines

Wolfgang,
Is it possible to NACK all patch that add new driver that do this

You mean, automatically? I would not know how to do that.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"Deliver yesterday, code today, think tomorrow."
#5 lore raw

PATCH v2 3/7 add an i2c driver for mx31

Quoted 10 lines · Wolfgang Denk
Quoted 3 lines · In message <[email protected]> you wrote:
Quoted 2 lines

+#if defined(CONFIG_HARD_I2C) && defined (CONFIG_I2C_MXC)

Please stop to define this here, move it the Makefile

Hm... While I agree with the simple standard case of a single "#ifdef", I'm not so 100% sure it is a good thing to add such complex expressions to the Makefile.

Aren't we just moving the #ifdef hell from one place to another?

Wouldn't it be logical to assume, that if CONFIG_I2C_MXC is defined, CONFIG_HARD_I2C is meant too? So, we could just put in i2c.h

#ifdef CONFIG_I2C_MXC
#define CONFIG_HARD_I2C
#endif

And then use the simple

OBJC-$(CONFIG_I2C_MXC) += ...

Incremental patch?

in the Makefile? I personally do prefer when unneeded .c files do not get compiled at all, rather than compiled to "0"-byte big objects. Makes the build process and the resulting tree look cleaner, and the image a bit smaller.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.

DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de

#6 lore raw

PATCH v2 3/7 add an i2c driver for mx31

Quoted 16 lines · Guennadi Liakhovetski
Quoted 10 lines · Wolfgang Denk
Quoted 3 lines · In message <[email protected]> you wrote:
Quoted 2 lines

+#if defined(CONFIG_HARD_I2C) && defined (CONFIG_I2C_MXC)

Please stop to define this here, move it the Makefile

Hm... While I agree with the simple standard case of a single "#ifdef", I'm not so 100% sure it is a good thing to add such complex expressions to the Makefile.

Aren't we just moving the #ifdef hell from one place to another?

Wouldn't it be logical to assume, that if CONFIG_I2C_MXC is defined, CONFIG_HARD_I2C is meant too? So, we could just put in i2c.h

Quoted 8 lines

#ifdef CONFIG_I2C_MXC
#define CONFIG_HARD_I2C
#endif

And then use the simple

OBJC-$(CONFIG_I2C_MXC) += ...

Yes, this is the way I'd solve the problem.

Cheers,
g.

Signature · 2 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
#7 lore raw

PATCH v2 3/7 add an i2c driver for mx31

Quoted 21 lines · Grant Likely
Quoted 20 lines · Guennadi Liakhovetski
Quoted 10 lines · Wolfgang Denk
Quoted 3 lines · In message <[email protected]> you wrote:
Quoted 2 lines

+#if defined(CONFIG_HARD_I2C) && defined (CONFIG_I2C_MXC)

Please stop to define this here, move it the Makefile

Hm... While I agree with the simple standard case of a single "#ifdef", I'm not so 100% sure it is a good thing to add such complex expressions to the Makefile.

Aren't we just moving the #ifdef hell from one place to another?

Wouldn't it be logical to assume, that if CONFIG_I2C_MXC is defined, CONFIG_HARD_I2C is meant too? So, we could just put in i2c.h

#ifdef CONFIG_I2C_MXC
#define CONFIG_HARD_I2C
#endif

Quoted 6 lines
Quoted 4 lines

And then use the simple

OBJC-$(CONFIG_I2C_MXC) += ...

Yes, this is the way I'd solve the problem.

I dont't like the idean to modify the i2c.h for each i2c drivers implemetation. I prefer to keep it into the config file and move it to the Kconfig.
I hope that I've time the next merge window to send it.

Best Regards,
J.

#8 lore raw

PATCH v2 3/7 add an i2c driver for mx31

In reply to Guennadi Liakhovetski
Quoted 5 lines · In message <[email protected]> you wrote:
Quoted 2 lines

Aren't we just moving the #ifdef hell from one place to another?

Wouldn't it be logical to assume, that if CONFIG_I2C_MXC is defined, CONFIG_HARD_I2C is meant too? So, we could just put in i2c.h

Well, what exactly is CONFIG_I2C_MXC supposed to mean? Sorry for asking, but I cannot find it documented anywhere (hint! hint! This needs to be fixed!). I tend to believe that in it's current form it's redundant, meaning that we have both CONFIG_CMD_I2C and CONFIG_MX31.

Quoted 3 lines

#ifdef CONFIG_I2C_MXC
#define CONFIG_HARD_I2C
#endif

Depending on the intended meaning of CONFIG_I2C_MXC there could also be someone who wants to use soft-I2C on that processors.

Quoted 4 lines

in the Makefile? I personally do prefer when unneeded .c files do not get compiled at all, rather than compiled to "0"-byte big objects. Makes the build process and the resulting tree look cleaner, and the image a bit smaller.

Me too.

But then, I definitely want to keep the Makefiles simple and clean, too.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"... freedom ... is a worship word..."
"It is our worship word too."
	-- Cloud William and Kirk, "The Omega Glory", stardate unknown
#9 lore raw

PATCH v2 3/7 add an i2c driver for mx31

Quoted 11 lines · Wolfgang Denk
Quoted 5 lines · In message <[email protected]> you wrote:
Quoted 2 lines

Aren't we just moving the #ifdef hell from one place to another?

Wouldn't it be logical to assume, that if CONFIG_I2C_MXC is defined, CONFIG_HARD_I2C is meant too? So, we could just put in i2c.h

Well, what exactly is CONFIG_I2C_MXC supposed to mean? Sorry for asking, but I cannot find it documented anywhere (hint! hint! This needs to be fixed!). I tend to believe that in it's current form it's redundant, meaning that we have both CONFIG_CMD_I2C and CONFIG_MX31.

Ok, looking at examples, e.g., at cpu/mpc824x/drivers/i2c/i2c.c, it looks like u-boot presumes, that a system may only want to use one (hardware) i2c driver. I don't understand why this restriction is made, but if we want to keep it, we could just drop CONFIG_I2C_MXC and just use CONFIG_HARD_I2C. As for redundancy - that's exactly the reason why I don't think it is redundant. I can imagine an i.MX31 based system with another hardware i2c controller, wanting to use the external one and not needing the built-in one.

My preference would be to let CONFIG_I2C_MXC mean "use the mxc_i2c.c driver for I2C controllers like those on i.MX* / MXC SoCs from Freescale," similar to how i2c host drivers under drivers/i2c use their (also not always documented) config options:

CONFIG_TSI108_I2C, CONFIG_DRIVER_OMAP24XX_I2C, CONFIG_DRIVER_OMAP1510_I2C

and they just define both the hartdware-specific config and CONFIG_HARD_I2C in their *_config.h, but check only for the specific one in the .c file. So, shall I just remove the ifdef from .c, add

OBJS-$(CONFIG_I2C_MXC) += ...

to the Makefile and add it to the README?

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.

DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de

#10 lore raw

PATCH v2 3/7 add an i2c driver for mx31

In reply to Guennadi Liakhovetski
Quoted 4 lines · Guennadi Liakhovetski

I personally do prefer when unneeded .c files do not get compiled at all, rather than compiled to "0"-byte big objects. Makes the build process and the resulting tree look cleaner, and the image a bit smaller.

That's how it is done in u-boot-v2, btw.

Robert

Signature · 5 lines
 Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de
 Pengutronix - Linux Solutions for Science and Industry
   Handelsregister:  Amtsgericht Hildesheim, HRA 2686
     Hannoversche Str. 2, 31134 Hildesheim, Germany
   Phone: +49-5121-206917-0 |  Fax: +49-5121-206917-9