drivers: PMC MSP71xx TWI driver]
Subsystems (2)
PATCH 8/12 drivers: PMC MSP71xx TWI driver]
Resending this cc'ed to the I2C list and maintainer Jean Delvare.
At a quick glance it looks like a fair driver but it will need some changes to work for Linux 2.6.22 but I'll leave the details to Jean Delvare.
Ralf
----- Forwarded message from Marc St-Jean <[email protected]> -----
From: Marc St-Jean <[email protected]>
Date: Fri, 16 Mar 2007 15:39:51 -0600
To: [email protected]
Cc: [email protected]
Subject: [PATCH 8/12] drivers: PMC MSP71xx TWI driver
[PATCH 8/12] drivers: PMC MSP71xx TWI driver
Patch to add TWI driver for the PMC-Sierra MSP71xx devices.
Reposting patches as a single set at the request of akpm. Only 9 of 12 will be posted at this time, 3 more to follow when cleanups are complete.
CCing linux-mips.org since minor changes have occured during cleanup of driver patches for other lists.
Thanks,
Marc
---
Re-posting patch with recommended changes:
-No changes.
drivers/i2c/algos/Kconfig | 9 drivers/i2c/algos/Makefile | 1 drivers/i2c/algos/i2c-algo-pmctwi.c | 197 ++++++++++++++++ drivers/i2c/busses/Kconfig | 7 drivers/i2c/busses/Makefile | 1 drivers/i2c/busses/i2c-pmcmsp.c | 419 ++++++++++++++++++++++++++++++++++++ include/linux/i2c-algo-pmctwi.h | 135 +++++++++++ 7 files changed, 768 insertions(+), 1 deletion(-)
drivers/i2c/algos/Kconfig +8 -1
@@ -49,5 +49,12 @@ config I2C_ALGO_SGI Supports the SGI interfaces like the ones found on SGI Indy VINO or SGI O2 MACE. -endmenu +config I2C_ALGO_PMCTWI + tristate "I2C PMC TWI interfaces" + depends on I2C && PMC_MSP + help + Implements the PMC TWI SoC algorithm for various implementations. + Be sure to select the proper bus for your platform below. + +endmenu
drivers/i2c/algos/Makefile +1 -0
@@ -6,6 +6,7 @@ obj-$(CONFIG_I2C_ALGOBIT) += i2c-algo-bit.o obj-$(CONFIG_I2C_ALGOPCF) += i2c-algo-pcf.o obj-$(CONFIG_I2C_ALGOPCA) += i2c-algo-pca.o obj-$(CONFIG_I2C_ALGO_SGI) += i2c-algo-sgi.o +obj-$(CONFIG_I2C_ALGO_PMCTWI) += i2c-algo-pmctwi.o ifeq ($(CONFIG_I2C_DEBUG_ALGO),y) EXTRA_CFLAGS += -DDEBUG
drivers/i2c/algos/i2c-algo-pmctwi.c new file +197 -0
197 lines not on this page · raw message
drivers/i2c/busses/Kconfig +7 -0
@@ -573,4 +573,11 @@ config I2C_PNX This driver can also be built as a module. If so, the module will be called i2c-pnx. +config I2C_PMCMSP + tristate "PMC MSP I2C Controller" + depends on I2C && PMC_MSP + select I2C_ALGO_PMCTWI + help + Supports the special PMC TWI SoC chip on the MSP platform + endmenu
drivers/i2c/busses/Makefile +1 -0
@@ -30,6 +30,7 @@ obj-$(CONFIG_I2C_PARPORT_LIGHT) += i2c-parport-light.o obj-$(CONFIG_I2C_PASEMI) += i2c-pasemi.o obj-$(CONFIG_I2C_PCA_ISA) += i2c-pca-isa.o obj-$(CONFIG_I2C_PIIX4) += i2c-piix4.o +obj-$(CONFIG_I2C_PMCMSP) += i2c-pmcmsp.o obj-$(CONFIG_I2C_PNX) += i2c-pnx.o obj-$(CONFIG_I2C_PROSAVAGE) += i2c-prosavage.o obj-$(CONFIG_I2C_PXA) += i2c-pxa.o
drivers/i2c/busses/i2c-pmcmsp.c new file +419 -0
419 lines not on this page · raw message
include/linux/i2c-algo-pmctwi.h new file +135 -0
135 lines not on this page · raw message
----- End forwarded message -----
Ralf
Marc,
Quoted 27 lines
----- Forwarded message from Marc St-Jean <[email protected]> -----
From: Marc St-Jean <[email protected]>
Date: Fri, 16 Mar 2007 15:39:51 -0600
To: [email protected]
Cc: [email protected]
Subject: [PATCH 8/12] drivers: PMC MSP71xx TWI driver[PATCH 8/12] drivers: PMC MSP71xx TWI driver
Patch to add TWI driver for the PMC-Sierra MSP71xx devices.
Reposting patches as a single set at the request of akpm. Only 9 of 12 will be posted at this time, 3 more to follow when cleanups are complete.
CCing linux-mips.org since minor changes have occured during cleanup of driver patches for other lists.
Thanks,
MarcSigned-off-by Marc St-Jean <[email protected]>---
Re-posting patch with recommended changes:
-No changes.
Quoted 8 lines
drivers/i2c/algos/Kconfig | 9 drivers/i2c/algos/Makefile | 1 drivers/i2c/algos/i2c-algo-pmctwi.c | 197 ++++++++++++++++ drivers/i2c/busses/Kconfig | 7 drivers/i2c/busses/Makefile | 1 drivers/i2c/busses/i2c-pmcmsp.c | 419 ++++++++++++++++++++++++++++++++++++ include/linux/i2c-algo-pmctwi.h | 135 +++++++++++ 7 files changed, 768 insertions(+), 1 deletion(-)
Why are you making a separate algorithm driver? This should really only be done when the algorithm is very generic. This is the exception, not the rule. These days I tend to move algorithm code back into the only bus driver that uses them (i2c-algo-sibyte done recently, i2c-algo-sgi is next on my list.)
drivers/i2c/algos/Kconfig config I2C_ALGO_SGI · line 54
Quoted 13 lines
drivers/i2c/algos/Kconfig +3
-1@@ -49,5 +49,12 @@ config I2C_ALGO_SGI Supports the SGI interfaces like the ones found on SGI Indy VINO or SGI O2 MACE. -endmenu +config I2C_ALGO_PMCTWI + tristate "I2C PMC TWI interfaces" + depends on I2C && PMC_MSP
As a matter of fact, each time an algorithm depends on specific hardware, you can be reasonably certain that it should NOT be made a generic algorithm driver.
Quoted 6 lines
drivers/i2c/algos/Kconfig +5
-0+ help + Implements the PMC TWI SoC algorithm for various implementations. + Be sure to select the proper bus for your platform below. + +endmenu
Signature · 1 line
Jean Delvare
On Sat, Mar 17, 2007 at 08:52:44AM +0100, Jean Delvare wrote:
[snip]
Quoted 5 lines
Why are you making a separate algorithm driver? This should really only be done when the algorithm is very generic. This is the exception, not the rule. These days I tend to move algorithm code back into the only bus driver that uses them (i2c-algo-sibyte done recently, i2c-algo-sgi is next on my list.)
Please remove i2c-algo-sgi from your list. This algorithm is used by the VINO asic (drivers/media/video/vino.c) present in SGI Indy machines as well as by the MACE asic (no driver exist yet) present in SGI O2 machines. You may consider applying this patch (also removes trailing whitespace).
drivers/i2c/algos/i2c-algo-sgi.c renamed from drivers/i2c/algos/i2c-algo-sgi.c.orig +5 -4
@@ -1,6 +1,7 @@/* -* i2c-algo-sgi.c: i2c driver algorithms for SGI adapters. -* +* i2c-algo-sgi.c: i2c driver algorithm used by the VINO (SGI Indy) and +* MACE (SGI O2) chips. +* * This file is subject to the terms and conditions of the GNU General Public * License version 2 as published by the Free Software Foundation. *
@@ -162,8 +163,8 @@ .functionality = sgi_func, }; -/* -* registering functions to load algorithms at runtime +/* +* registering functions to load algorithms at runtime */ int i2c_sgi_add_bus (struct i2c_adapter *adap) {
Hi Ladislav,
Quoted 11 lines · Ladislav Michl
On Sat, Mar 17, 2007 at 08:52:44AM +0100, Jean Delvare wrote:
[snip]Quoted 5 lines
Why are you making a separate algorithm driver? This should really only be done when the algorithm is very generic. This is the exception, not the rule. These days I tend to move algorithm code back into the only bus driver that uses them (i2c-algo-sibyte done recently, i2c-algo-sgi is next on my list.)
Please remove i2c-algo-sgi from your list. This algorithm is used by the VINO asic (
drivers/media/video/vino.c) present in SGI Indy machines as well as by the MACE asic (no driver exist yet) present in SGI O2 machines.
OK, thanks for the info. It's hard to tell for sure without seeing the missing code for the MACE, but I still think that the split between the different source files is not correct. I think that you want to have one platform-based i2c bus driver (not just algorithm), which works with both the VINO and the MACE, one dedicated driver for the Indy which glues the I2C bus, the SAA7191 and the Indycam together, and another dedicated driver for the O2 which glues the I2C bus and whatever chips are on it, together.
BTW, the vino driver is on my (now very short) list of drivers which create i2c busses without a valid parent. It doesn't seem to fit in the Linux 2.6 device driver model at all. If you have supported hardware, could you please fix this? You probably simply need to create a platform driver and device for the VINO chip, and use that as the parent of the i2c bus.
Quoted 17 lines
You may consider applying this patch (also removes trailing whitespace).
Signed-off-by Ladislav Michl <[email protected]>drivers/i2c/algos/i2c-algo-sgi.c renamed from drivers/i2c/algos/i2c-algo-sgi.c.orig +3
-2@@ -1,6 +1,7 @@/* -* i2c-algo-sgi.c: i2c driver algorithms for SGI adapters. -* +* i2c-algo-sgi.c: i2c driver algorithm used by the VINO (SGI Indy) and +* MACE (SGI O2) chips. +* * This file is subject to the terms and conditions of the GNU General Public * License version 2 as published by the Free Software Foundation. *
drivers/i2c/algos/i2c-algo-sgi.c line 170
Quoted 10 lines
drivers/i2c/algos/i2c-algo-sgi.c renamed from drivers/i2c/algos/i2c-algo-sgi.c.orig +2
-2@@ -162,8 +163,8 @@ .functionality = sgi_func, }; -/* -* registering functions to load algorithms at runtime +/* +* registering functions to load algorithms at runtime */ int i2c_sgi_add_bus (struct i2c_adapter *adap) {
OK, I'll apply this, it cannot hurt.
Thanks,
Signature · 1 line
Jean Delvare