i2c: adds support for i2c bus on Freescale CPM1/CPM2 controllers
Subsystems (5)
Jochen Friedrich
maintainerPATCH v3 1/1 i2c: adds support for i2c bus on Freescale 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/mpc8272ads.dts | 10 + 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 | 759 ++++++++++++++++++++++++++ 7 files changed, 805 insertions(+), 0 deletions(-) create mode 100644 drivers/i2c/busses/i2c-cpm.c
arch/powerpc/boot/dts/mpc8272ads.dts +10 -0
@@ -215,6 +215,16 @@ linux,network-index = <1>; fsl,cpm-command = <16200300>; }; + + i2c@11860 { + compatible = "fsl,mpc8248-i2c", + "fsl,cpm2-i2c", + "fsl,cpm-i2c"; + reg = <11860 20 8afc 2>; + interrupts = <1 8>; + interrupt-parent = <&PIC>; + fsl,cpm-command = <29600000>; + }; }; PIC: interrupt-controller@10c00 {
arch/powerpc/boot/dts/mpc866ads.dts +10 -0
@@ -169,6 +169,16 @@ fsl,cpm-command = <0000>; linux,network-index = <1>; }; + + 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 +10 -0
@@ -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 +5 -0
@@ -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 +10 -0
@@ -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 +1 -0
@@ -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 +759 -0
759 lines not on this page · raw message
Signature · 1 line
1.5.3.8
Quoted 6 lines · Jochen Friedrich
arch/powerpc/boot/dts/mpc866ads.dts +0
-0@@ -169,6 +169,16 @@ fsl,cpm-command = <0000>;
arch/powerpc/boot/dts/mpc866ads.dts line 179
Quoted 10 lines
arch/powerpc/boot/dts/mpc866ads.dts +8
-0linux,network-index = <1>; }; + + i2c@860 { + compatible = "fsl,mpc866-i2c", + "fsl,cpm1-i2c", + "fsl,cpm-i2c"; + reg = <860 20 3c80 30>; + interrupts = <10 3>; + interrupt-parent = <&Cpm_pic>;
The label is &CPM_PIC in the current mpc866ads.dts.
-Scott
_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c
Quoted 10 lines · Jochen Friedrich
Using the port of 2.4 code from Vitaly Bordug <[email protected]
Quoted 1 line
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.candi2c-algo-8xx.ctoi2c-cpm.cand converted the driver to anof_platform_driver.Signed-off-by Jochen Friedrich <[email protected]>---
Quoted 9 lines
arch/powerpc/boot/dts/mpc8272ads.dts | 10 + 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 | 759 +++++++++++++++++ +++++++++ 7 files changed, 805 insertions(+), 0 deletions(-)
really should be split in two patches. The drivers/i2c/* should go via the i2c maintainers. the arch/powerpc via me or vitaly.
- k
_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c
Quoted 136 lines · Jochen Friedrich
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.candi2c-algo-8xx.ctoi2c-cpm.cand converted the driver to anof_platform_driver.Signed-off-by Jochen Friedrich <[email protected]>--- arch/powerpc/boot/dts/mpc8272ads.dts | 10 + 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 | 759 ++++++++++++++++++++++++++ 7 files changed, 805 insertions(+), 0 deletions(-) create mode 100644 drivers/i2c/busses/i2c-cpm.carch/powerpc/boot/dts/mpc8272ads.dts +10
-0@@ -215,6 +215,16 @@ linux,network-index = <1>; fsl,cpm-command = <16200300>; }; + + i2c@11860 { + compatible = "fsl,mpc8248-i2c", + "fsl,cpm2-i2c", + "fsl,cpm-i2c"; + reg = <11860 20 8afc 2>; + interrupts = <1 8>; + interrupt-parent = <&PIC>; + fsl,cpm-command = <29600000>; + }; }; PIC: interrupt-controller@10c00 {arch/powerpc/boot/dts/mpc866ads.dts +10
-0@@ -169,6 +169,16 @@ fsl,cpm-command = <0000>; linux,network-index = <1>; }; + + 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 +10
-0@@ -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 +5
-0@@ -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 +10
-0@@ -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_DAVINCIdrivers/i2c/busses/Makefile +1
-0@@ -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.odrivers/i2c/busses/i2c-cpm.c new file +0
-0
drivers/i2c/busses/i2c-cpm.c line 4
Quoted 4 lines
drivers/i2c/busses/i2c-cpm.c new file +4
-0@@ -0,0 +1,759 @@ +/* +* Freescale CPM1/CPM2 I2C interface. +* Copyright (c) 1999 Dan Malek ([email protected]). +*
[!snip!]
drivers/i2c/busses/i2c-cpm.c line 688
Quoted 4 lines
drivers/i2c/busses/i2c-cpm.c new file +4
-0+ +/* register new adapter to i2c module... */ + + result =i2c_add_adapter (&cpm->adap);
As I was pointed before, please use the new style i2c driver interface:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=991dee591a99d035796a8c194eb1796cc020e142
-Bryan Wu
[!snip!]
Jochen Friedrich
maintainerHi Bryan,
Quoted 7 lines
drivers/i2c/busses/i2c-cpm.c line 688
Quoted 4 lines
drivers/i2c/busses/i2c-cpm.c new file +4
-0+ +/* register new adapter to i2c module... */ + + result =i2c_add_adapter (&cpm->adap);As I was pointed before, please use the new style i2c driver interface:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=991dee591a99d035796a8c194eb1796cc020e142
AFAIK, the device tree currently doesn't provide an adapter id. If we're going to add this property, this would be needed on other of_platform i2c drivers, as well.
Thanks,
Jochen