diff --git a/CHANGES b/CHANGES index 64d6ebc8..3218b612 100644 --- a/CHANGES +++ b/CHANGES @@ -5,6 +5,7 @@ SVN HEAD Man page i2cdetect.8: Scanning range can be restricted Module bmcsensors: Fix debugging messages Module i2c-ali1563: Improve the status messages (2.6 backport) + Fix device initialization (2.6 backport) Module i2c-amd8111: Cleanups (2.6 backport) Fix initialization race (2.6 backport) Module i2c-nforce2: Drop unused reference to pci_dev (2.6 backport) diff --git a/kernel/busses/i2c-ali1563.c b/kernel/busses/i2c-ali1563.c index 69dc50fa..87cc2d2c 100644 --- a/kernel/busses/i2c-ali1563.c +++ b/kernel/busses/i2c-ali1563.c @@ -326,35 +326,12 @@ static u32 ali1563_func(struct i2c_adapter * a) } -static void ali1563_enable(struct pci_dev * dev) -{ - u16 ctrl; - - pci_read_config_word(dev,ALI1563_SMBBA,&ctrl); - ctrl |= 0x7; - pci_write_config_word(dev,ALI1563_SMBBA,ctrl); -} - static int __devinit ali1563_setup(struct pci_dev * dev) { u16 ctrl; pci_read_config_word(dev,ALI1563_SMBBA,&ctrl); - /* Check if device is even enabled first */ - if (!(ctrl & ALI1563_SMB_IOEN)) { - printk(KERN_WARNING "ali1563: I/O space not enabled, trying manually\n"); - ali1563_enable(dev); - } - if (!(ctrl & ALI1563_SMB_IOEN)) { - printk(KERN_WARNING "ali1563: I/O space still not enabled, giving up\n"); - goto Err; - } - if (!(ctrl & ALI1563_SMB_HOSTEN)) { - printk(KERN_WARNING "ali1563: Host Controller not enabled\n"); - goto Err; - } - /* SMB I/O Base in high 12 bits and must be aligned with the * size of the I/O space. */ ali1563_smba = ctrl & ~(ALI1563_SMB_IOSIZE - 1); @@ -362,6 +339,24 @@ static int __devinit ali1563_setup(struct pci_dev * dev) printk(KERN_WARNING "ali1563: ali1563_smba Uninitialized\n"); goto Err; } + + /* Check if device is enabled */ + if (!(ctrl & ALI1563_SMB_HOSTEN)) { + printk(KERN_WARNING "ali1563: Host Controller not enabled\n"); + goto Err; + } + if (!(ctrl & ALI1563_SMB_IOEN)) { + printk(KERN_WARNING "I/O space not enabled, trying manually\n"); + pci_write_config_word(dev, ALI1563_SMBBA, + ctrl | ALI1563_SMB_IOEN); + pci_read_config_word(dev, ALI1563_SMBBA, &ctrl); + if (!(ctrl & ALI1563_SMB_IOEN)) { + printk(KERN_WARNING "I/O space still not enabled, " + "giving up\n"); + goto Err; + } + } + if (!request_region(ali1563_smba, ALI1563_SMB_IOSIZE, ali1563_pci_driver.name)) { printk(KERN_WARNING "ali1563: Could not allocate I/O space "