Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 23236
b: refs/heads/master
c: 16ffc5c
h: refs/heads/master
v: v3
  • Loading branch information
Ben Gardner authored and Greg Kroah-Hartman committed Mar 23, 2006
1 parent 64eaf68 commit 44635f6
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 15 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: 8a05940d742174a87427a3fe746712d49d4b8c4b
refs/heads/master: 16ffc5c99554bc1630bc3939e0950a75b2b1c811
57 changes: 43 additions & 14 deletions trunk/drivers/i2c/busses/scx200_acb.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Copyright (c) 2001,2002 Christer Weinigel <wingel@nano-system.com>
National Semiconductor SCx200 ACCESS.bus support
Also supports the AMD CS5535 and AMD CS5536
Based on i2c-keywest.c which is:
Copyright (c) 2001 Benjamin Herrenschmidt <benh@kernel.crashing.org>
Expand Down Expand Up @@ -31,6 +32,7 @@
#include <linux/pci.h>
#include <linux/delay.h>
#include <asm/io.h>
#include <asm/msr.h>

#include <linux/scx200.h>

Expand Down Expand Up @@ -416,7 +418,7 @@ static int scx200_acb_probe(struct scx200_acb_iface *iface)
return 0;
}

static int __init scx200_acb_create(int base, int index)
static int __init scx200_acb_create(const char *text, int base, int index)
{
struct scx200_acb_iface *iface;
struct i2c_adapter *adapter;
Expand All @@ -432,16 +434,17 @@ static int __init scx200_acb_create(int base, int index)

adapter = &iface->adapter;
i2c_set_adapdata(adapter, iface);
snprintf(adapter->name, I2C_NAME_SIZE, "SCx200 ACB%d", index);
snprintf(adapter->name, I2C_NAME_SIZE, "%s ACB%d", text, index);
adapter->owner = THIS_MODULE;
adapter->id = I2C_HW_SMBUS_SCX200;
adapter->algo = &scx200_acb_algorithm;
adapter->class = I2C_CLASS_HWMON;

init_MUTEX(&iface->sem);

snprintf(description, sizeof(description),
"NatSemi SCx200 ACCESS.bus [%s]", adapter->name);
snprintf(description, sizeof(description), "%s ACCESS.bus [%s]",
text, adapter->name);

if (request_region(base, 8, description) == 0) {
printk(KERN_ERR NAME ": can't allocate io 0x%x-0x%x\n",
base, base + 8-1);
Expand Down Expand Up @@ -485,24 +488,50 @@ static struct pci_device_id scx200[] = {
{ },
};

static struct pci_device_id divil_pci[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_CS5535_ISA) },
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_ISA) },
{ } /* NULL entry */
};

#define MSR_LBAR_SMB 0x5140000B

static int scx200_add_cs553x(void)
{
u32 low, hi;
u32 smb_base;

/* Grab & reserve the SMB I/O range */
rdmsr(MSR_LBAR_SMB, low, hi);

/* Check the IO mask and whether SMB is enabled */
if (hi != 0x0000F001) {
printk(KERN_WARNING NAME ": SMBus not enabled\n");
return -ENODEV;
}

/* SMBus IO size is 8 bytes */
smb_base = low & 0x0000FFF8;

return scx200_acb_create("CS5535", smb_base, 0);
}

static int __init scx200_acb_init(void)
{
int i;
int rc;
int rc = -ENODEV;

pr_debug(NAME ": NatSemi SCx200 ACCESS.bus Driver\n");

/* Verify that this really is a SCx200 processor */
if (pci_dev_present(scx200) == 0)
return -ENODEV;
if (pci_dev_present(scx200)) {
for (i = 0; i < MAX_DEVICES; ++i) {
if (base[i] > 0)
rc = scx200_acb_create("SCx200", base[i], i);
}
} else if (pci_dev_present(divil_pci))
rc = scx200_add_cs553x();

rc = -ENXIO;
for (i = 0; i < MAX_DEVICES; ++i) {
if (base[i] > 0)
rc = scx200_acb_create(base[i], i);
}
if (scx200_acb_list)
return 0;
return rc;
}

Expand Down

0 comments on commit 44635f6

Please sign in to comment.