Skip to contentSkip to conversation

lm_sensors i2c-amd756 detection trouble

DISCUSSION Daniel Rune Jensen 4 participants 15 messages May 19, 2005

lore
Share & tools
lore
#0 lore raw

Hi there :)
Have some trouble with my ASUS A7M266-D and lm_sensors. It actually was running fine until i enabled:
AMD 76x native power management (Experimental)

from dmesg
amd76x_pm: Version 20020730
amd76x_pm: Initializing northbridge Advanced Micro Devices [AMD] AMD-760 MP [IGD4-2P] System Controller
amd76x_pm: Initializing southbridge Advanced Micro Devices [AMD] AMD-768 [Opus] ACPI

i was using lm_sensors 2.8.1 but when i booted no sensors was found. I searched the net around for answers and found that the amd76x is using the bridge where lm_sensors would like to be, and thus lm_sensors suddenly can't find any smbus. Also it should be possible to revert back into lm_sensors 2.7.0 which would fix problems. I have tried the cvs version 2, as i saw there were some fixes for amd756.

from sensors-detect:

We can start with probing for (PCI) I2C or SMBus adapters.
You do not need any special privileges for this.
Do you want to probe now? (YES/no):
Probing for PCI bus adapters...
Use driver `i2c-amd756' for device 00:07.3: AMD-768 System Management Probe succesfully concluded.
We will now try to load each adapter module in turn.
Load `i2c-amd756' (say NO if built into your kernel)? (YES/no):

/lib/modules/2.4.23/kernel/drivers/i2c/busses/i2c-amd756.o: init_module:
No such device
Hint: insmod errors can be caused by incorrect module parameters, including invalid IO or IRQ parameters /lib/modules/2.4.23/kernel/drivers/i2c/busses/i2c-amd756.o: insmod /lib/modules/2.4.23/kernel/drivers/i2c/busses/i2c-amd756.o failed /lib/modules/2.4.23/kernel/drivers/i2c/busses/i2c-amd756.o: insmod i2c-amd756 failed
Loading failed... skipping.

Now to the question :)
Can this be fixed in lm_sensors, or does it need to be i the kernel tree where the experimental apmd resides, or is it simply unfixable ?

Regards

Daniel Jensen

#1 lore raw
Quoted 12 lines · Daniel Rune Jensen
Quoted 10 lines

i was using lm_sensors 2.8.1 but when i booted no sensors was found. I searched the net around for answers and found that the amd76x is using the bridge where lm_sensors would like to be, and thus lm_sensors suddenly can't find any smbus. Also it should be possible to revert back into lm_sensors 2.7.0 which would fix problems. I have tried the cvs version 2, as i saw there were some fixes for amd756.

Can this be fixed in lm_sensors, or does it need to be i the kernel tree where the experimental apmd resides, or is it simply unfixable ?

Quoted 9 lines

Fixable in lm_sensors, I'd say. The i2c-amd756 driver tries to claim the complete PCI function, while it only needs to reserve the I/O region for the SMBus controller.

See i2c-viapro module_init, it seems to have a similar fix already applied.

Signature · 1 line
  Ky?sti M?lkki  <[email protected]>

I have looked at the i2c-viapro module, and changed the i2c-amd756.c source code so the module_init looks the same, but it still won't load. Gives a:
/lib/modules/2.4.23/kernel/drivers/i2c/busses/i2c-amd756.o: init_module:
No such device
Can anyone clarify this for me ?

Regards
Daniel

#2 lore raw
In reply to Daniel Rune Jensen
Quoted 9 lines · Daniel Rune Jensen
Quoted 7 lines

I have looked at the i2c-viapro module, and changed the i2c-amd756.c source code so the module_init looks the same, but it still won't load. Gives a:
/lib/modules/2.4.23/kernel/drivers/i2c/busses/i2c-amd756.o: init_module:
No such device
Can anyone clarify this for me ?

Quoted 11 lines

Maybe the other driver has reserved the SMBus I/O region, either for a reason or due lazy programming. There should be something in the logfiles. If not, compare output of the following with and without amd76x_pm to see what regions it claims. Or read the source..

cat /proc/ioports
cat /proc/iomem
/sbin/lspci -xxx

Signature · 1 line
  Ky?sti M?lkki  <[email protected]>

Been working on this for hours but not getting much further :) Logs doesn't show much:
while apmd is not running
i2c-amd756.o version 2.8.1 (20031005)
i2c-amd756: SMBREV = 0x3
i2c-amd756: AMD756_smba = 0xE4E0

and when running it just gives a:

i2c-amd756.o version 2.8.1 (20031005)

Have compared output and only the one from lspci differs Output from lspci -xxx with apmd loaded

00:07.3 Bridge: Advanced Micro Devices [AMD]: Unknown device 7443 (rev 03) 00: 22 10 43 74 00 00 80 02 03 00 80 06 00 20 00 00
10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
20: 00 00 00 00 00 00 00 00 00 00 00 00 43 10 44 80
30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
40: 80 b1 09 42 00 00 00 00 aa 00 50 00 00 00 00 01
50: 01 80 00 00 0f 00 ab 4c 01 e4 00 00 00 00 00 00
60: 00 00 80 06 1f 00 00 00 00 00 00 00 00 00 00 00
70: 00 00 00 00 00 00 00 00 00 00 00 00 43 10 44 80
80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
c0: 00 00 00 00 60 00 00 00 00 00 00 00 00 00 00 00
d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
f0: 8c 98 13 00 00 00 00 00 00 00 00 00 00 00 00 00

Output from lspci -xxx without apmd loaded
00:07.3 Bridge: Advanced Micro Devices [AMD]: Unknown device 7443 (rev 03) 00: 22 10 43 74 00 00 80 02 03 00 80 06 00 20 00 00
10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
20: 00 00 00 00 00 00 00 00 00 00 00 00 43 10 44 80
30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
40: 80 b1 09 42 00 00 00 00 aa 00 50 00 00 00 00 01
50: 01 80 00 00 0f 00 ab 4c 01 e4 00 00 00 00 00 00
60: 00 00 80 06 1f 00 00 00 00 00 00 00 00 00 00 00
70: 00 00 00 00 00 00 00 00 00 00 00 00 43 10 44 80
80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
c0: 00 00 00 00 60 00 00 00 00 00 00 00 00 00 00 00
d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
f0: eb 0d 35 00 00 00 00 00 00 00 00 00 00 00 00 00

Output from lspci -xxx with i2c-amd756 loaded

00:07.3 Bridge: Advanced Micro Devices [AMD]: Unknown device 7443 (rev 03) 00: 22 10 43 74 00 00 80 02 03 00 80 06 00 20 00 00
10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
20: 00 00 00 00 00 00 00 00 00 00 00 00 43 10 44 80
30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
40: 80 b1 09 42 00 00 00 00 aa 00 50 00 00 00 00 01
50: 01 80 00 00 0f 00 ab 4c 01 e4 00 00 00 00 00 00
60: 00 00 80 06 1f 00 00 00 00 00 00 00 00 00 00 00
70: 00 00 00 00 00 00 00 00 00 00 00 00 43 10 44 80
80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
c0: 00 00 00 00 60 00 00 00 00 00 00 00 00 00 00 00
d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
f0: 8f b0 30 00 00 00 00 00 00 00 00 00 00 00 00 00

as i am not a coder i really can't use this for much other than i can see the last line is different :)

The code from i2c-amd756.c:
};

static int __init i2c_amd756_init(void)

{
        printk(KERN_INFO "i2c-amd756.o version %s (%s)\n", LM_VERSION, LM_DATE);
        return pci_module_init(&amd756_driver);
}

static void __exit i2c_amd756_exit(void)

{
        pci_unregister_driver(&amd756_driver);
        release_region(amd756_ioport, SMB_IOSIZE);
}

And the code with modifications:

static int __init i2c_amd756_init(void)

{
        struct pci_dev *dev;
        const struct pci_device_id *id;

        printk(KERN_INFO "i2c-amd756.o version %s (%s)\n", LM_VERSION, LM_DATE);

        return pci_module_init(&amd756_driver);
        pci_for_each_dev(dev) {
                id = pci_match_device(amd756_ids, dev);
                if(id)
                        if(amd756_probe(dev, id) >= 0)
                                return 0;
        }
        return -ENODEV;

}

static void __exit i2c_amd756_exit(void)

{
        pci_unregister_driver(&amd756_driver);
        release_region(amd756_ioport, SMB_IOSIZE);
}

Regards
Daniel

#3 lore raw
In reply to Daniel Rune Jensen
Quoted 11 lines

And the code with modifications:

static int __init i2c_amd756_init(void)

{
        struct pci_dev *dev;
        const struct pci_device_id *id;

        printk(KERN_INFO "i2c-amd756.o version %s (%s)\n", LM_VERSION,
        LM_DATE);

        return pci_module_init(&amd756_driver);
          ^^^^^^

That return in the middle of the function might explain why you don't see the change... ;) Strange if gcc did not tell you about that.

Quoted 10 lines
        pci_for_each_dev(dev) {
                id = pci_match_device(amd756_ids, dev);
                if(id)
                        if(amd756_probe(dev, id) >= 0)
                                return 0;
        }
        return -ENODEV;

}

Signature · 2 lines
Jean Delvare
http://www.ensicaen.ismra.fr/~delvare/
#4 lore raw
In reply to Daniel Rune Jensen
Quoted 21 lines · Daniel Rune Jensen
Quoted 11 lines

static int __init i2c_amd756_init(void)

{
        struct pci_dev *dev;
        const struct pci_device_id *id;

        printk(KERN_INFn 0;
        }
        return -ENODEV;
Quoted 8 lines

}

static void __exit i2c_amd756_exit(void)

{
        pci_unregister_driver(&amd756_driver);
        release_region(amd756_ioport, SMB_IOSIZE);
}
Quoted 6 lines

Comment out pci_module_init and pci_unregister_driver. This was the critical change of not claiming the complete PCI device in i2c-viapro and others.

Signature · 1 line
  Ky?sti M?lkki  <[email protected]>

Oh must really have been sleeping, did not notice it was uncommented. And yes it actually seems to work now, thanx a lot for your help. Here is the code which i changed, and finnaly got to work:

starting on line 400: (cvs version 10/12-2003)

/* Don't register driver to avoid driver conflicts */ /*
static struct pci_driver amd756_driver = {

        .name           = "amd7xx smbus",
        .id_table       = amd756_ids,
        .probe          = amd756_probe,
        .remove         = __devexit_p(amd756_remove),

};
*/

static int __init i2c_amd756_init(void)

{
        struct pci_dev *dev;
        const struct pci_device_id *id;
 
        printk(KERN_INFO "i2c-amd756.o version %s (%s)\n", LM_VERSION, LM_DATE);
/*
        return pci_module_init(&amd756_driver);
*/
        pci_for_each_dev(dev) {
                id = pci_match_device(amd756_ids, dev);
                if(id)
                        if(amd756_probe(dev, id) >= 0)
                                return 0; 
        }
        return -ENODEV;
}

static void __exit i2c_amd756_exit(void)
{
/*

        pci_unregister_driver(&amd756_driver);
*/
        release_region(amd756_ioport, SMB_IOSIZE);
}

MODULE_AUTHOR("Merlin Hughes <[email protected]>"); MODULE_DESCRIPTION("AMD756/766/768/8111 and nVidia nForce SMBus driver"); MODULE_LICENSE("GPL");

module_init(i2c_amd756_init)
module_exit(i2c_amd756_exit)

Regards
Daniel

#5 lore raw
In reply to Daniel Rune Jensen

please let us know your results after you have commented out the offending line.
It should work.

Quoted 31 lines · Jean Delvare
Quoted 4 lines

And the code with modifications:

static int __init i2c_amd756_init(void)

Quoted 8 lines
{
        struct pci_dev *dev;
        const struct pci_device_id *id;

        printk(KERN_INFO "i2c-amd756.o version %s (%s)\n", LM_VERSION,
        LM_DATE);

        return pci_module_init(&amd756_driver);
          ^^^^^^

That return in the middle of the function might explain why you don't see the change... ;) Strange if gcc did not tell you about that.

Quoted 10 lines
        pci_for_each_dev(dev) {
                id = pci_match_device(amd756_ids, dev);
                if(id)
                        if(amd756_probe(dev, id) >= 0)
                                return 0;
        }
        return -ENODEV;

}

--
Jean Delvare
http://www.ensicaen.ismra.fr/~delvare/

#6 lore raw
In reply to Daniel Rune Jensen
Quoted 9 lines · Daniel Rune Jensen

i was using lm_sensors 2.8.1 but when i booted no sensors was found. I searched the net around for answers and found that the amd76x is using the bridge where lm_sensors would like to be, and thus lm_sensors suddenly can't find any smbus. Also it should be possible to revert back into lm_sensors 2.7.0 which would fix problems. I have tried the cvs version 2, as i saw there were some fixes for amd756.

Can this be fixed in lm_sensors, or does it need to be i the kernel tree where the experimental apmd resides, or is it simply unfixable ?

Fixable in lm_sensors, I'd say. The i2c-amd756 driver tries to claim the complete PCI function, while it only needs to reserve the I/O region for the SMBus controller.

See i2c-viapro module_init, it seems to have a similar fix already applied.

Signature · 1 line
  Ky?sti M?lkki  <[email protected]>
#7 lore raw
In reply to Daniel Rune Jensen
Quoted 6 lines · Daniel Rune Jensen

I have looked at the i2c-viapro module, and changed the i2c-amd756.c source code so the module_init looks the same, but it still won't load. Gives a:
/lib/modules/2.4.23/kernel/drivers/i2c/busses/i2c-amd756.o: init_module:
No such device
Can anyone clarify this for me ?

Maybe the other driver has reserved the SMBus I/O region, either for a reason or due lazy programming. There should be something in the logfiles. If not, compare output of the following with and without amd76x_pm to see what regions it claims. Or read the source..

cat /proc/ioports
cat /proc/iomem
/sbin/lspci -xxx

Signature · 1 line
  Ky?sti M?lkki  <[email protected]>
#8 lore raw
In reply to Daniel Rune Jensen

----------------------- Original Message -----------------------

 From:    Daniel Rune Jensen <[email protected]>
 To:      Mark Studebaker <[email protected]>
 Date:    Sat, 14 Feb 2004 17:41:35 +0100

Subject: Re: lm_sensors i2c-amd756 detection trouble
----

Quoted 4 lines

please let us know your results after you have commented out the offending line.
It should work.

Reported to work some time ago :) As i would like to see changes go into the package i will now try to submit a .diff for 2.8.4 which allows amd756 to be loaded together with amd76x_pm.o:

i2c-amd756.diff
*** i2c-amd756.c Sun Dec 14 18:19:30 2003
--- i2c-amd756.c Thu Jan 22 16:25:32 2004
***************
*** 396,418 ****
--- 396,436 ----

        i2c_del_adapter(&amd756_adapter);

}

+ /* Don't register driver to avoid driver conflicts */
+ /*
static struct pci_driver amd756_driver = {

        .name           = "amd756 smbus",
        .id_table       = amd756_ids,
        .probe          = amd756_probe,
        .remove         = __devexit_p(amd756_remove),

};
+ */

static int __init i2c_amd756_init(void)
{
+ struct pci_dev *dev;
+ const struct pci_device_id *id;
+

        printk(KERN_INFO "i2c-amd756.o version %s (%s)\n", LM_VERSION, LM_DATE);
+ /*
        return pci_module_init(&amd756_driver);

+ */
+ pci_for_each_dev(dev) {
+ id = pci_match_device(amd756_ids, dev);
+ if(id)
+ if(amd756_probe(dev, id) >= 0)
+ return 0;
+ }
+ return -ENODEV;
+
}

static void __exit i2c_amd756_exit(void)
{
+ /*

        pci_unregister_driver(&amd756_driver);
+ */
        release_region(amd756_ioport, SMB_IOSIZE);

}
Regards

Signature · 6 lines
Daniel Rune Jensen <[email protected]>

--------------------- Original Message Ends --------------------

-- 
Daniel Rune Jensen <[email protected]>
#9 lore raw
In reply to Daniel Rune Jensen
Quoted 1 line

Reported to work some time ago :)

You're right. Your mail was colored in red in my box, but I finally forgot about it. Good think you bring our attention on the problem again.

Quoted 3 lines

As i would like to see changes go into the package i will now try to submit a .diff for 2.8.4 which allows amd756 to be loaded together with amd76x_pm.o:

This patch doesn't apply, most probably because your e-mail client broke it. Please reconfigure your client or provide the patch as an attachement so that it comes to me intact.

Thanks.

Signature · 2 lines
Jean Delvare
http://www.ensicaen.ismra.fr/~delvare/
#10 lore raw
In reply to Daniel Rune Jensen
Quoted 10 lines
Quoted 1 line

Reported to work some time ago :)

This patch doesn't apply, most probably because your e-mail client broke it. Please reconfigure your client or provide the patch as an attachement so that it comes to me intact.

Thanks.

Ohh i am real sorry about that. Sending it as an attachment hope it will work. Else it is at:
http://eth0.dk/misc/i2c-amd756.diff

Regards
Daniel Rune Jensen <[email protected]>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: i2c-amd756.diff
Type: application/octet-stream
Size: 1088 bytes
Desc: not available
Url : http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20040215/4db7e499/i2c-amd756.obj

#11 lore raw
In reply to Daniel Rune Jensen
Quoted 3 lines

Ohh i am real sorry about that. Sending it as an attachment hope it will work. Else it is at:
http://eth0.dk/misc/i2c-amd756.diff

OK, applied. I made some changes (do not include the commented out stuff at all, reindent properly). Please checkout from CVS and confirm that it works OK.

Is something similar needed for the Linux 2.6 version of the driver?

Signature · 2 lines
Jean Delvare
http://www.ensicaen.ismra.fr/~delvare/
#12 lore raw
In reply to Daniel Rune Jensen
Quoted 4 lines
Quoted 3 lines

Ohh i am real sorry about that. Sending it as an attachment hope it will work. Else it is at:
http://eth0.dk/misc/i2c-amd756.diff

Quoted 9 lines

OK, applied. I made some changes (do not include the commented out stuff at all, reindent properly). Please checkout from CVS and confirm that it works OK.

Is something similar needed for the Linux 2.6 version of the driver?

Signature · 2 lines
Jean Delvare
http://www.ensicaen.ismra.fr/~delvare/

Sorry for the late answer been quite busy. Sorry about the lousy code but i am not a programmer, just needed it to load :) And it works quite fine from cvs. I must admit i don't have a clue to if changes for 2.6 is needed, my machine is running production so i can't take it offline but will have a second server in a week or so with same chipset so i could make some tests there.

Best regards

Signature · 1 line
Daniel Rune Jensen <[email protected]>
#13 lore raw
In reply to Daniel Rune Jensen
Quoted 2 lines

Sorry about the lousy code but i am not a programmer, just needed it to load :) And it works quite fine from cvs.

Possible but it wasn't correct (and gcc was nice enough to warn us). The i2c bus wasn't unregistered at module unload (you can try...). I've hopefully fixed that in CVS. Can you please try and confirm that it works for you?

Thanks.

Signature · 2 lines
Jean Delvare
http://www.ensicaen.ismra.fr/~delvare/
#14 lore raw
In reply to Daniel Rune Jensen
Quoted 13 lines
Quoted 2 lines

Sorry about the lousy code but i am not a programmer, just needed it to load :) And it works quite fine from cvs.

Possible but it wasn't correct (and gcc was nice enough to warn us). The i2c bus wasn't unregistered at module unload (you can try...). I've hopefully fixed that in CVS. Can you please try and confirm that it works for you?

Thanks.

Signature · 2 lines
Jean Delvare
http://www.ensicaen.ismra.fr/~delvare/

Hi there :)
Actually you were correct, module wasn't unloading and giving a load of 1.0 on the box just sitting there. It seems to be working now, and can be unloaded.

Best Regards

Signature · 1 line
Daniel Rune Jensen <[email protected]>