Skip to contentSkip to conversation

drivers: PMC MSP71xx TWI driver]

PATCH Marc St-Jean 2 participants 2 messages Mar 21, 2007 MIPS

lore
Share & tools
lore
#0 lore raw
Quoted 37 lines · Jean Delvare

Marc,

Quoted 1 line

----- Forwarded message from Marc St-Jean <[email protected]>

-----

Quoted 26 lines
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.

Quoted 6 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 

++++++++++++++++++++++++++++++++++++

Quoted 8 lines
Quoted 2 lines
 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.)

I believe it was done to separate the algorithm for the TWI sub-system, which is used in several devices, from the device family code. If this is no longer acceptable I will merge the algo code with the adapter.

Quoted 8 lines
Quoted 8 lines
drivers/i2c/algos/Kconfig +0 -0
index af02034..794f7bb 100644
@@ -49,5 +49,12 @@ config I2C_ALGO_SGI
        Supports the SGI interfaces like the ones found on SGI Indy VINO
        or SGI O2 MACE.
 
Quoted 8 lines

drivers/i2c/algos/Kconfig config I2C_ALGO_SGI · line 54

Quoted 4 lines
drivers/i2c/algos/Kconfig +3 -1
-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.

OK.

Quoted 11 lines

drivers/i2c/algos/Kconfig config I2C_ALGO_SGI · line 56

Quoted 2 lines
drivers/i2c/algos/Kconfig +2 -0
+     help
+       Implements the PMC TWI SoC algorithm for various 

implementations.

Quoted 4 lines
drivers/i2c/algos/Kconfig +3 -0
+       Be sure to select the proper bus for your platform below.
+
+endmenu
Signature · 1 line
Jean Delvare
#1 lore raw

Hi Marc,

Quoted 10 lines · Marc St-Jean
Quoted 5 lines · Jean Delvare

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.)

I believe it was done to separate the algorithm for the TWI sub-system, which is used in several devices, from the device family code. If this is no longer acceptable I will merge the algo code with the adapter.

You should be able to have a single i2c bus driver handling all the different devices, by using the platform data to provide the device-specific configuration. The i2c-algorithm concept is quite old, now that we have a clean new device driver model it should no longer be necessary in most cases.

Signature · 1 line
Jean Delvare