Skip to contentSkip to conversation

i2c: adds support for i2c bus on Frescale CPM1/CPM2 controllers

PATCH In review Jochen Friedrich 3 participants 4 messages Dec 21, 2007 – Jan 23, 2008

Subsystems (5)
lore
Share & tools
lore

Jochen Friedrich

author maintainer
#0 lore raw

PATCH 1/1 i2c: adds support for i2c bus on Frescale CPM1/CPM2 controllers

Using the port of 2.4 code from Vitaly Bordug <[email protected]> and the actual algorithm used by the i2c driver of the DBox code on cvs.tuxboc.org from Tmbinc, Gillem ([email protected]). Renamed i2c-rpx.c and i2c-algo-8xx.c to i2c-cpm.c and converted the driver to an of_platform_driver.

---

arch/powerpc/boot/dts/mpc866ads.dts          |   10 +
arch/powerpc/boot/dts/mpc885ads.dts          |   10 +
arch/powerpc/platforms/8xx/mpc885ads_setup.c |    5 +
drivers/i2c/busses/Kconfig                   |   10 +
drivers/i2c/busses/Makefile                  |    1 +
drivers/i2c/busses/i2c-cpm.c                 |  776 ++++++++++++++++++++++++++
6 files changed, 812 insertions(+), 0 deletions(-)

create mode 100644 drivers/i2c/busses/i2c-cpm.c

arch/powerpc/boot/dts/mpc866ads.dts +0 -0
index 90f2293..c79cac1 100644
@@ -141,6 +141,16 @@
				interrupts = <1e 3>;
				interrupt-parent = <&Cpm_pic>;
			};

+
+ i2c@860 {
+ compatible = "fsl,mpc866-i2c",
+ "fsl,cpm1-i2c",
+ "fsl,cpm-i2c";
+ reg = <860 20 3c80 30>;
+ interrupts = <10 3>;
+ interrupt-parent = <&Cpm_pic>;
+ fsl,cpm-command = <0010>;

+			};
		};
	};
};
arch/powerpc/boot/dts/mpc885ads.dts +0 -0
index 8848e63..fd9c9d7 100644
@@ -213,6 +213,16 @@
				fsl,cpm-command = <0080>;
				linux,network-index = <2>;
			};

+
+ i2c@860 {
+ compatible = "fsl,mpc885-i2c",
+ "fsl,cpm1-i2c",
+ "fsl,cpm-i2c";
+ reg = <860 20 3c80 30>;
+ interrupts = <10>;
+ interrupt-parent = <&CPM_PIC>;
+ fsl,cpm-command = <0010>;

+			};
		};
	};
arch/powerpc/platforms/8xx/mpc885ads_setup.c +0 -0
index 2cf1b6a..4377521 100644
@@ -157,6 +157,11 @@ static struct cpm_pin mpc885ads_pins[] = {
	{CPM_PORTE, 28, CPM_PIN_OUTPUT},
	{CPM_PORTE, 29, CPM_PIN_OUTPUT},

#endif
+ /* I2C */
+#ifdef CONFIG_I2C_8XX
+ {CPM_PORTB, 26, CPM_PIN_INPUT | CPM_PIN_OPENDRAIN},
+ {CPM_PORTB, 27, CPM_PIN_INPUT | CPM_PIN_OPENDRAIN},
+#endif
};

static void __init init_ioports(void)

drivers/i2c/busses/Kconfig +0 -0
index c466c6c..5950172 100644
@@ -114,6 +114,16 @@ config I2C_BLACKFIN_TWI_CLK_KHZ

help
The unit of the TWI clock is kHz.

+config I2C_CPM
+ tristate "Freescale CPM1 or CPM2 (MPC8xx/826x)"
+ depends on (CPM1 || CPM2) && I2C && PPC_OF
+ help
+ This supports the use of the I2C interface on Freescale
+ processors with CPM1 or CPM2.
+
+ This driver can also be built as a module. If so, the module
+ will be called i2c-cpm.
+
config I2C_DAVINCI
tristate "DaVinci I2C driver"
depends on ARCH_DAVINCI

drivers/i2c/busses/Makefile +0 -0
index 81d43c2..a395555 100644
@@ -11,6 +11,7 @@ obj-$(CONFIG_I2C_AMD8111)	+= i2c-amd8111.o

obj-$(CONFIG_I2C_AT91) += i2c-at91.o
obj-$(CONFIG_I2C_AU1550) += i2c-au1550.o
obj-$(CONFIG_I2C_BLACKFIN_TWI) += i2c-bfin-twi.o
+obj-$(CONFIG_I2C_CPM) += i2c-cpm.o
obj-$(CONFIG_I2C_DAVINCI) += i2c-davinci.o
obj-$(CONFIG_I2C_ELEKTOR) += i2c-elektor.o
obj-$(CONFIG_I2C_GPIO) += i2c-gpio.o

drivers/i2c/busses/i2c-cpm.c new file +776 -0

776 lines not on this page · raw message

Signature · 1 line
1.5.3.7
#1 lore raw
Quoted 6 lines · On Fri, 21 Dec 2007 20:36:28 +0100 Jochen Friedrich wrote:

Using the port of 2.4 code from Vitaly Bordug <[email protected]> and the actual algorithm used by the i2c driver of the DBox code on cvs.tuxboc.org from Tmbinc, Gillem ([email protected]). Renamed i2c-rpx.c and i2c-algo-8xx.c to i2c-cpm.c and converted the driver to an of_platform_driver.

I had an attempt a while ago to do this but haven't had enough time to get it completed, so
I am glad to see it finally picked up. There was some sort of discussion that time, you seem to have some of those points addressed but something not, please
check: http://lkml.org/lkml/2007/5/8/45

(for instance, cpm_i2c_shutdown() and i2c_cpm_del_bus() are void because they cant' fail)

Also, why this was directed to Scott? This is lm-sensors stuff and is Jean Delvare <[email protected]> material...

Signature · 1 line
Sincerely, Vitaly
author maintainer
#2 lore raw

Hi Vitaly,

Quoted 7 lines

I had an attempt a while ago to do this but haven't had enough time to get it completed, so
I am glad to see it finally picked up. There was some sort of discussion that time, you seem to have some of those points addressed but something not, please
check: http://lkml.org/lkml/2007/5/8/45

(for instance, cpm_i2c_shutdown() and i2c_cpm_del_bus() are void because they cant' fail)

I'll resend a fixed patch.

Quoted 2 lines

Also, why this was directed to Scott? This is lm-sensors stuff and is Jean Delvare <[email protected]> material..

Scott reviewed this driver last time and i hope to get some further comments from him. But thanks for adding Jean as well.

Thanks,
Jochen

#3 lore raw
In reply to Vitaly Bordug
Quoted 15 lines · Vitaly Bordug
Quoted 6 lines · On Fri, 21 Dec 2007 20:36:28 +0100 Jochen Friedrich wrote:

Using the port of 2.4 code from Vitaly Bordug <[email protected]> and the actual algorithm used by the i2c driver of the DBox code on cvs.tuxboc.org from Tmbinc, Gillem ([email protected]). Renamed i2c-rpx.c and i2c-algo-8xx.c to i2c-cpm.c and converted the driver to an of_platform_driver.

I had an attempt a while ago to do this but haven't had enough time to get it completed, so
I am glad to see it finally picked up. There was some sort of discussion that time, you seem to have some of those points addressed but something not, please
check: http://lkml.org/lkml/2007/5/8/45

Quoted 4 lines

(for instance, cpm_i2c_shutdown() and i2c_cpm_del_bus() are void because they cant' fail)

Also, why this was directed to Scott? This is lm-sensors stuff and is Jean Delvare <[email protected]> material...

This is _i2c_ stuff and doesn't have _anything_ to do with lm-sensors. (Don't let the i2c list address fool you.)

As the i2c subsystem maintainer, I am very pleased when contributors get their patches reviewed and tested by people with the knowledge and access to the target architecture and hardware. So Jochen did the right thing by sending this patch to Scott at first.

Signature · 1 line
Jean Delvare