Skip to contentSkip to conversation

EP-9NDA3+ w/ Winbond W83627THF LPC

DISCUSSION erek 3 participants 9 messages May 19, 2005

lore
Share & tools
lore

erek

author
#0 lore raw

i have a nForce3 250GB Ultra motherboard "EPoX EP-9NDA3+" that has the "Winbond W83627THF LPC" chip...

but some odd reason i can't get it to work..

localhost erek # modprobe w83627hf
FATAL: Error inserting w83627hf (/lib/modules/2.6.8.1/kernel/drivers/i2c/chips/w83627hf.ko): No such device
localhost erek #

i don't understand what's wrong?

#1 lore raw
Quoted 3 lines

the motherboard manufacturer says it has the chip and sensors-detect says it has 9 confidence on w83627hf (it should be w83627(T)hf)..

w83627hf is both the name of a chip and the name of the driver which handles that chip and 3 other ones (including the w83627thf). That might have confused you. OTOH, if sensors-detect really told you that you had a W83627HF then that's what you have (it cannot be misdetected).

Quoted 4 lines

my dmesg and /var/log/messages don't show anymore details after that error.. i use syslog-ng.. doesn't seem to report much into /var/log/messages.. :(
(what is a better logger?)

Loggers behave the way they are told to, and another logger wouldn't tell you more (IMHO). I am really surprised that there is no message in the logs. Try enabling debug mode and recompile, maybe?

--
Jean Delvare

#2 lore raw
In reply to erek
Quoted 3 lines

i have a nForce3 250GB Ultra motherboard "EPoX EP-9NDA3+" that has the "Winbond W83627THF LPC" chip...

How do you know it has this chip? Did sensors-detect tell you?

Quoted 9 lines

but some odd reason i can't get it to work..

localhost erek # modprobe w83627hf
FATAL: Error inserting w83627hf (/lib/modules/2.6.8.1/kernel/drivers/i2c/chips/w83627hf.ko): No such device
localhost erek #

i don't understand what's wrong?

Look at your logs (/var/log/messages or dmesg) right after the loading fails. There should be a more detailed explanation there, maybe the chip is there but disabled by the BIOS or something like that.

--
Jean Delvare

#3 lore raw
In reply to erek

Explanation was: the W83627THF is on secondary Super-I/O address (0x4e/0x4f), and the driver doesn't support that.

The driver would need to be updated in the same way I did for the pc87360.

Signature · 2 lines
Jean Delvare
http://khali.linux-fr.org/
#4 lore raw
In reply to erek

Hi again Erek,

Quoted 5 lines

Explanation was: the W83627THF is on secondary Super-I/O address (0x4e/0x4f), and the driver doesn't support that.

The driver would need to be updated in the same way I did for the pc87360.

I have come up with a very simplified patch that would do that. Not exactly elegant but it keeps the changes to a minimum. The one I worked on while we were on IRC was really too complex and had drawbacks too.

I have attached the patch to this mail, could you please give it a try? It should apply to your 2.6.8.1 kernel just fine (to the original file of course, not the one we modified together). If it works I'll push it to Greg for inclusion into the main kernel tree, and will also backport it to our lm_sensors CVS repository.

I also have a second patch (attached too) which partly rewrites the way the VID pins (nominal CPU core voltage) are read on the W83627THF (the chip you have). I would be grateful if you could give a try to this one too (again, should apply fine to your 2.6.8.1 kernel on top of the first one of this mail) and report if VID value is still OK for you. The patch drops useless code and adds additional validity checks and support for VRM 10 (6-bit VID values).

Thanks,

Signature · 103 lines
Jean Delvare
http://khali.linux-fr.org/
-------------- next part --------------
--- linux-2.6.10-rc3/drivers/i2c/chips/w83627hf.c.orig	2004-12-19 12:14:44.000000000 +0100
+++ linux-2.6.10-rc3/drivers/i2c/chips/w83627hf.c	2004-12-19 12:55:31.000000000 +0100
@@ -67,9 +67,9 @@
 MODULE_PARM_DESC(init, "Set to zero to bypass chip initialization");
 
 /* modified from kernel/include/traps.c */
-#define	REG	0x2e	/* The register to read/write */
+static int REG;		/* The register to read/write */
 #define	DEV	0x07	/* Register: Logical device select */
-#define	VAL	0x2f	/* The value to read/write */
+static int VAL;		/* The value to read/write */
 
 /* logical device numbers for superio_select (below) */
 #define W83627HF_LD_FDC		0x00
@@ -938,10 +938,13 @@
 	return i2c_detect(adapter, &addr_data, w83627hf_detect);
 }
 
-static int w83627hf_find(int *address)
+static int w83627hf_find(int sioaddr, int *address)
 {
 	u16 val;
 
+	REG = sioaddr;
+	VAL = sioaddr + 1;
+
 	superio_enter();
 	val= superio_inb(DEVID);
 	if(val != W627_DEVID &&
@@ -1422,7 +1425,8 @@
 {
 	int addr;
 
-	if (w83627hf_find(&addr)) {
+	if (w83627hf_find(0x2e, &addr)
+	 && w83627hf_find(0x4e, &addr)) {
 		return -ENODEV;
 	}
 	normal_isa[0] = addr;
-------------- next part --------------
--- linux-2.6.10-rc3/drivers/i2c/chips/w83627hf.c.orig	2004-12-19 12:55:31.000000000 +0100
+++ linux-2.6.10-rc3/drivers/i2c/chips/w83627hf.c	2004-12-19 13:57:59.000000000 +0100
@@ -90,9 +90,9 @@
 
 #define	DEVID	0x20	/* Register: Device ID */
 
+#define W83627THF_GPIO5_EN	0x30 /* w83627thf only */
 #define W83627THF_GPIO5_IOSR	0xf3 /* w83627thf only */
 #define W83627THF_GPIO5_DR	0xf4 /* w83627thf only */
-#define W83627THF_GPIO5_INVR	0xf5 /* w83627thf only */
 
 static inline void
 superio_outb(int reg, int val)
@@ -1190,16 +1190,31 @@
 
 static int w83627thf_read_gpio5(struct i2c_client *client)
 {
-	struct w83627hf_data *data = i2c_get_clientdata(client);
-	int res, inv;
+	int res = 0xff, sel;
 
-	down(&data->lock);
 	superio_enter();
 	superio_select(W83627HF_LD_GPIO5);
-	res = superio_inb(W83627THF_GPIO5_DR);
-	inv = superio_inb(W83627THF_GPIO5_INVR);
+
+	/* Make sure these GPIO pins are enabled */
+	if (!(superio_inb(W83627THF_GPIO5_EN) & (1<<3))) {
+		dev_dbg(&client->dev, "GPIO5 disabled, no VID function\n");
+		goto exit;
+	}
+
+	/* Make sure the pins are configured for input
+	   There must be at least five (VRM 9), and possibly 6 (VRM 10) */
+	sel = superio_inb(W83627THF_GPIO5_IOSR);
+	if ((sel & 0x1f) != 0x1f) {
+		dev_dbg(&client->dev, "GPIO5 not configured for VID "
+			"function\n");
+		goto exit;
+	}
+
+	dev_info(&client->dev, "Reading VID from GPIO5\n");
+	res = superio_inb(W83627THF_GPIO5_DR) & sel;
+
+exit:
 	superio_exit();
-	up(&data->lock);
 	return res;
 }
 
@@ -1272,7 +1287,7 @@
 		int hi = w83627hf_read_value(client, W83781D_REG_CHIPID);
 		data->vid = (lo & 0x0f) | ((hi & 0x01) << 4);
 	} else if (w83627thf = data->type) {
-		data->vid = w83627thf_read_gpio5(client) & 0x1f;
+		data->vid = w83627thf_read_gpio5(client) & 0x3f;
 	}
 
 	/* Read VRM & OVT Config only once */
#5 lore raw
In reply to erek

Hi Jean:

Quoted 11 lines · Jean Delvare

Hi again Erek,

Quoted 5 lines

Explanation was: the W83627THF is on secondary Super-I/O address (0x4e/0x4f), and the driver doesn't support that.

The driver would need to be updated in the same way I did for the pc87360.

I have come up with a very simplified patch that would do that. Not exactly elegant but it keeps the changes to a minimum. The one I worked on while we were on IRC was really too complex and had drawbacks too.

It looks OK to me; not sure what you don't like about it.

Quoted 6 lines

I have attached the patch to this mail, could you please give it a try? It should apply to your 2.6.8.1 kernel just fine (to the original file of course, not the one we modified together). If it works I'll push it to Greg for inclusion into the main kernel tree, and will also backport it to our lm_sensors CVS repository.

Quoted 7 lines

I also have a second patch (attached too) which partly rewrites the way the VID pins (nominal CPU core voltage) are read on the W83627THF (the chip you have). I would be grateful if you could give a try to this one too (again, should apply fine to your 2.6.8.1 kernel on top of the first one of this mail) and report if VID value is still OK for you. The patch drops useless code and adds additional validity checks and support for VRM 10 (6-bit VID values).

I added both patches to my stack and it works fine here. But of course my chip uses the normal 0x2e/0x2f.

(...)

Review

Quoted 1 line
(quoted diff) +1 -0
+	dev_info(&client->dev, "Reading VID from GPIO5\n");

I think this should be dev_dbg().

Regards,

Signature · 2 lines
Mark M. Hoffman
[email protected]
#6 lore raw
In reply to erek
Quoted 18 lines · Jean Delvare

Hi Mark,

Quoted 6 lines
Quoted 4 lines

I have come up with a very simplified patch that would do that. Not exactly elegant but it keeps the changes to a minimum. The one I worked on while we were on IRC was really too complex and had drawbacks too.

It looks OK to me; not sure what you don't like about it.

Global variable sucks. The way I supported the secondary Super-I/O address to the pc87360 driver looks far better to me, but unfortunately it doesn't work for the w83627hf driver because it accesses the Super-I/O space outside of the "find" function.

Quoted 3 lines

Review

Quoted 1 line
(quoted diff) +1 -0
+	dev_info(&client->dev, "Reading VID from GPIO5\n");

I think this should be dev_dbg().

Quoted 5 lines

Why? I think it's useful for the regular user to know that we are reading the VID value from GPIO pins (which by definition could be used for something different). It would also help us track problems if people report about bad cpu0_vid value with that driver. If you can come up with a better message, let me know.

Oops, we read the VID just once, not every update. Nevermind.

Quoted 5 lines

Maybe it would be even better to *not* create any cpu0_vid file when the GPIO pins are not possibly used for that, instead of returning the default value (all bits set) which in turn will result in a 0V value. This would require more changes (including in the sensors program), and I don't think I'll go into that until I get a supported chip myself.

Nah, I think it's fine the way it is for now.

Regards,

Signature · 2 lines
Mark M. Hoffman
[email protected]
#7 lore raw
In reply to erek

Hi Mark,

Quoted 6 lines
Quoted 4 lines

I have come up with a very simplified patch that would do that. Not exactly elegant but it keeps the changes to a minimum. The one I worked on while we were on IRC was really too complex and had drawbacks too.

It looks OK to me; not sure what you don't like about it.

Global variable sucks. The way I supported the secondary Super-I/O address to the pc87360 driver looks far better to me, but unfortunately it doesn't work for the w83627hf driver because it accesses the Super-I/O space outside of the "find" function.

Quoted 3 lines

Review

Quoted 1 line
(quoted diff) +1 -0
+	dev_info(&client->dev, "Reading VID from GPIO5\n");

I think this should be dev_dbg().

Why? I think it's useful for the regular user to know that we are reading the VID value from GPIO pins (which by definition could be used for something different). It would also help us track problems if people report about bad cpu0_vid value with that driver. If you can come up with a better message, let me know.

Maybe it would be even better to *not* create any cpu0_vid file when the GPIO pins are not possibly used for that, instead of returning the default value (all bits set) which in turn will result in a 0V value. This would require more changes (including in the sensors program), and I don't think I'll go into that until I get a supported chip myself.

Thanks,

Signature · 2 lines
Jean Delvare
http://khali.linux-fr.org/
author
#8 lore raw
In reply to erek
Quoted 33 lines · Jean Delvare
Quoted 18 lines

Hi Mark,

Quoted 6 lines
Quoted 4 lines

I have come up with a very simplified patch that would do that. Not exactly elegant but it keeps the changes to a minimum. The one I worked on while we were on IRC was really too complex and had drawbacks too.

It looks OK to me; not sure what you don't like about it.

Global variable sucks. The way I supported the secondary Super-I/O address to the pc87360 driver looks far better to me, but unfortunately it doesn't work for the w83627hf driver because it accesses the Super-I/O space outside of the "find" function.

Quoted 3 lines

Review

Quoted 1 line
(quoted diff) +1 -0
+	dev_info(&client->dev, "Reading VID from GPIO5\n");

I think this should be dev_dbg().

Quoted 5 lines

Why? I think it's useful for the regular user to know that we are reading the VID value from GPIO pins (which by definition could be used for something different). It would also help us track problems if people report about bad cpu0_vid value with that driver. If you can come up with a better message, let me know.

Oops, we read the VID just once, not every update. Nevermind.

Quoted 5 lines

Maybe it would be even better to *not* create any cpu0_vid file when the GPIO pins are not possibly used for that, instead of returning the default value (all bits set) which in turn will result in a 0V value. This would require more changes (including in the sensors program), and I don't think I'll go into that until I get a supported chip myself.

Quoted 9 lines

Nah, I think it's fine the way it is for now.

Regards,

--
Mark M. Hoffman
[email protected]

thanks a lot for working so quickly