Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 28655
b: refs/heads/master
c: 6dcc19d
h: refs/heads/master
i:
  28653: 2607c72
  28651: 7241341
  28647: 5fe87cd
  28639: 90d460f
v: v3
  • Loading branch information
Jean Delvare authored and Greg Kroah-Hartman committed Jun 22, 2006
1 parent 06a5a68 commit 5bb5c45
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 455f332323a17446fb66ea7b2f65f2751f1a3f06
refs/heads/master: 6dcc19dfbc84b2ea5428711b7a47146b5b1788bb
38 changes: 27 additions & 11 deletions trunk/drivers/i2c/busses/i2c-i801.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
#define SMBAUXCTL (13 + i801_smba) /* ICH4 only */

/* PCI Address Constants */
#define SMBBA 0x020
#define SMBBAR 4
#define SMBHSTCFG 0x040
#define SMBREV 0x008

Expand Down Expand Up @@ -97,14 +97,15 @@ static int i801_transaction(void);
static int i801_block_transaction(union i2c_smbus_data *data, char read_write,
int command, int hwpec);

static unsigned short i801_smba;
static unsigned long i801_smba;
static struct pci_driver i801_driver;
static struct pci_dev *I801_dev;
static int isich4;

static int __devinit i801_setup(struct pci_dev *dev)
{
unsigned char temp;
int err;

I801_dev = dev;
if ((dev->device == PCI_DEVICE_ID_INTEL_82801DB_3) ||
Expand All @@ -114,19 +115,28 @@ static int __devinit i801_setup(struct pci_dev *dev)
else
isich4 = 0;

err = pci_enable_device(dev);
if (err) {
dev_err(&dev->dev, "Failed to enable SMBus device (%d)\n",
err);
goto exit;
}

/* Determine the address of the SMBus area */
pci_read_config_word(I801_dev, SMBBA, &i801_smba);
i801_smba &= 0xfff0;
i801_smba = pci_resource_start(dev, SMBBAR);
if (!i801_smba) {
dev_err(&dev->dev, "SMBus base address uninitialized, "
"upgrade BIOS\n");
return -ENODEV;
err = -ENODEV;
goto exit_disable;
}

if (!request_region(i801_smba, (isich4 ? 16 : 8), i801_driver.name)) {
dev_err(&dev->dev, "I801_smb region 0x%x already in use!\n",
i801_smba);
return -EBUSY;
err = pci_request_region(dev, SMBBAR, i801_driver.name);
if (err) {
dev_err(&dev->dev, "Failed to request SMBus region "
"0x%lx-0x%lx\n", i801_smba,
pci_resource_end(dev, SMBBAR));
goto exit_disable;
}

pci_read_config_byte(I801_dev, SMBHSTCFG, &temp);
Expand All @@ -147,6 +157,11 @@ static int __devinit i801_setup(struct pci_dev *dev)
dev_dbg(&dev->dev, "I801_smba = 0x%X\n", i801_smba);

return 0;

exit_disable:
pci_disable_device(dev);
exit:
return err;
}

static int i801_transaction(void)
Expand Down Expand Up @@ -521,14 +536,15 @@ static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id
i801_adapter.dev.parent = &dev->dev;

snprintf(i801_adapter.name, I2C_NAME_SIZE,
"SMBus I801 adapter at %04x", i801_smba);
"SMBus I801 adapter at %04lx", i801_smba);
return i2c_add_adapter(&i801_adapter);
}

static void __devexit i801_remove(struct pci_dev *dev)
{
i2c_del_adapter(&i801_adapter);
release_region(i801_smba, (isich4 ? 16 : 8));
pci_release_region(dev, SMBBAR);
pci_disable_device(dev);
}

static struct pci_driver i801_driver = {
Expand Down

0 comments on commit 5bb5c45

Please sign in to comment.