Skip to contentSkip to conversation

i2c-nforce2: Add support for multiplexing on the Tyan S4985

PATCH In review Jean Delvare 1 participant 2 messages May 6, 2008 – May 15, 2008 1 message not in the archive

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

PATCH 1/1 i2c-nforce2: Add support for multiplexing on the Tyan S4985

Just like the Tyan S4882, the S4985 uses a multiplexer to give access to all 16 memory module SPD EEPROMs. This specific i2c-nforce2-s4985 driver adds support for this. It is heavily based on the older i2c-amd756-s4882 driver.

As more mainboards will use multiplexer chips, we will have to find a way to support them without having to write a new specfic driver for each. The recent changes to the i2c subsystem should help us, and the new gpio subsystem might help, too.

---
 drivers/i2c/busses/Kconfig             |   13 +
 drivers/i2c/busses/Makefile            |    1 
 drivers/i2c/busses/i2c-nforce2-s4985.c |  261 ++++++++++++++++++++++++++++++++
 drivers/i2c/busses/i2c-nforce2.c       |   16 +
 4 files changed, 291 insertions(+)
drivers/i2c/busses/Kconfig +13 -0
@@ -315,6 +315,19 @@ config I2C_NFORCE2
 	  This driver can also be built as a module.  If so, the module
 	  will be called i2c-nforce2.
 
+config I2C_NFORCE2_S4985
+	tristate "SMBus multiplexing on the Tyan S4985"
+	depends on I2C_NFORCE2 && EXPERIMENTAL
+	help
+	  Enabling this option will add specific SMBus support for the Tyan
+	  S4985 motherboard.  On this 4-CPU board, the SMBus is multiplexed
+	  over 4 different channels, where the various memory module EEPROMs
+	  live.  Saying yes here will give you access to these in addition
+	  to the trunk.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called i2c-nforce2-s4985.
+
 config I2C_OCORES
 	tristate "OpenCores I2C Controller"
 	depends on EXPERIMENTAL
drivers/i2c/busses/Makefile +1 -0
@@ -24,6 +24,7 @@ obj-$(CONFIG_I2C_POWERMAC)	+= i2c-powerm
 obj-$(CONFIG_I2C_MPC)		+= i2c-mpc.o
 obj-$(CONFIG_I2C_MV64XXX)	+= i2c-mv64xxx.o
 obj-$(CONFIG_I2C_NFORCE2)	+= i2c-nforce2.o
+obj-$(CONFIG_I2C_NFORCE2_S4985)	+= i2c-nforce2-s4985.o
 obj-$(CONFIG_I2C_OCORES)	+= i2c-ocores.o
 obj-$(CONFIG_I2C_OMAP)		+= i2c-omap.o
 obj-$(CONFIG_I2C_PARPORT)	+= i2c-parport.o
drivers/i2c/busses/i2c-nforce2-s4985.c new file +261 -0

261 lines not on this page · raw message

drivers/i2c/busses/i2c-nforce2.c +16 -0
@@ -111,6 +111,20 @@ struct nforce2_smbus {
 
 static struct pci_driver nforce2_driver;
 
+/* For multiplexing support, we need a global reference to the 1st
+   SMBus channel */
+#if defined CONFIG_I2C_NFORCE2_S4985 || defined CONFIG_I2C_NFORCE2_S4985_MODULE
+struct i2c_adapter *nforce2_smbus;
+EXPORT_SYMBOL_GPL(nforce2_smbus);
+
+static void nforce2_set_reference(struct i2c_adapter *adap)
+{
+	nforce2_smbus = adap;
+}
+#else
+static inline void nforce2_set_reference(struct i2c_adapter *adap) { }
+#endif
+
 static void nforce2_abort(struct i2c_adapter *adap)
 {
 	struct nforce2_smbus *smbus = adap->algo_data;
@@ -378,6 +392,7 @@ static int __devinit nforce2_probe(struc
 		return -ENODEV;
 	}
 
+	nforce2_set_reference(&smbuses[0].adapter);
 	return 0;
 }
 
@@ -386,6 +401,7 @@ static void __devexit nforce2_remove(str
 {
 	struct nforce2_smbus *smbuses = (void*) pci_get_drvdata(dev);
 
+	nforce2_set_reference(NULL);
 	if (smbuses[0].base) {
 		i2c_del_adapter(&smbuses[0].adapter);
 		release_region(smbuses[0].base, smbuses[0].size);
Signature · 6 lines
Jean Delvare

_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c
#2 lore raw
In reply to a message not in the archive

Just like the Tyan S4882, the S4985 uses a multiplexer to give access to all 16 memory module SPD EEPROMs. This specific i2c-nforce2-s4985 driver adds support for this. It is heavily based on the older i2c-amd756-s4882 driver.

As more mainboards will use multiplexer chips, we will have to find a way to support them without having to write a new specfic driver for each. The recent changes to the i2c subsystem should help us, and the new gpio subsystem might help, too.

---
Updated to comply with the error code convention that has been discussed on the i2c list earlier this week.

 drivers/i2c/busses/Kconfig             |   13 +
 drivers/i2c/busses/Makefile            |    1 
 drivers/i2c/busses/i2c-nforce2-s4985.c |  257 ++++++++++++++++++++++++++++++++
 drivers/i2c/busses/i2c-nforce2.c       |   16 +
 4 files changed, 287 insertions(+)
drivers/i2c/busses/Kconfig +13 -0
@@ -315,6 +315,19 @@ config I2C_NFORCE2
 	  This driver can also be built as a module.  If so, the module
 	  will be called i2c-nforce2.
 
+config I2C_NFORCE2_S4985
+	tristate "SMBus multiplexing on the Tyan S4985"
+	depends on I2C_NFORCE2 && EXPERIMENTAL
+	help
+	  Enabling this option will add specific SMBus support for the Tyan
+	  S4985 motherboard.  On this 4-CPU board, the SMBus is multiplexed
+	  over 4 different channels, where the various memory module EEPROMs
+	  live.  Saying yes here will give you access to these in addition
+	  to the trunk.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called i2c-nforce2-s4985.
+
 config I2C_OCORES
 	tristate "OpenCores I2C Controller"
 	depends on EXPERIMENTAL
drivers/i2c/busses/Makefile +1 -0
@@ -24,6 +24,7 @@ obj-$(CONFIG_I2C_POWERMAC)	+= i2c-powerm
 obj-$(CONFIG_I2C_MPC)		+= i2c-mpc.o
 obj-$(CONFIG_I2C_MV64XXX)	+= i2c-mv64xxx.o
 obj-$(CONFIG_I2C_NFORCE2)	+= i2c-nforce2.o
+obj-$(CONFIG_I2C_NFORCE2_S4985)	+= i2c-nforce2-s4985.o
 obj-$(CONFIG_I2C_OCORES)	+= i2c-ocores.o
 obj-$(CONFIG_I2C_OMAP)		+= i2c-omap.o
 obj-$(CONFIG_I2C_PARPORT)	+= i2c-parport.o
drivers/i2c/busses/i2c-nforce2-s4985.c new file +257 -0

257 lines not on this page · raw message

drivers/i2c/busses/i2c-nforce2.c +16 -0
@@ -124,6 +124,20 @@ static struct dmi_system_id __devinitdat
 
 static struct pci_driver nforce2_driver;
 
+/* For multiplexing support, we need a global reference to the 1st
+   SMBus channel */
+#if defined CONFIG_I2C_NFORCE2_S4985 || defined CONFIG_I2C_NFORCE2_S4985_MODULE
+struct i2c_adapter *nforce2_smbus;
+EXPORT_SYMBOL_GPL(nforce2_smbus);
+
+static void nforce2_set_reference(struct i2c_adapter *adap)
+{
+	nforce2_smbus = adap;
+}
+#else
+static inline void nforce2_set_reference(struct i2c_adapter *adap) { }
+#endif
+
 static void nforce2_abort(struct i2c_adapter *adap)
 {
 	struct nforce2_smbus *smbus = adap->algo_data;
@@ -398,6 +412,7 @@ static int __devinit nforce2_probe(struc
 		return -ENODEV;
 	}
 
+	nforce2_set_reference(&smbuses[0].adapter);
 	return 0;
 }
 
@@ -406,6 +421,7 @@ static void __devexit nforce2_remove(str
 {
 	struct nforce2_smbus *smbuses = (void*) pci_get_drvdata(dev);
 
+	nforce2_set_reference(NULL);
 	if (smbuses[0].base) {
 		i2c_del_adapter(&smbuses[0].adapter);
 		release_region(smbuses[0].base, smbuses[0].size);
Signature · 6 lines
Jean Delvare

_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c