aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilly Tarreau <w@1wt.eu>2008-09-21 20:23:37 +0200
committerWilly Tarreau <w@1wt.eu>2008-11-09 23:30:25 +0100
commit71eb110d0ce07fd9993d81127a7131e6886910e2 (patch)
treef89f30372b81af20210564a01e9b199b67376c9c
parent444f269247924e73e25c76c9218f2c14edd56d48 (diff)
downloadlinux-2.4-71eb110d0ce07fd9993d81127a7131e6886910e2.tar.gz
i2c: add support for Geode Companion CS5535/5536 to scx200_acb
The Geode Companion Chip CS5535/5536 provides an i2c controller compatible with what is found in SCx200. Very little effort is required to initialise it. This code was backported from its 2.6 equivalent. Signed-off-by: Willy Tarreau <w@1wt.eu>
-rw-r--r--Documentation/Configure.help1
-rw-r--r--drivers/i2c/scx200_acb.c37
2 files changed, 33 insertions, 5 deletions
diff --git a/Documentation/Configure.help b/Documentation/Configure.help
index 4a4635acd81d29..b63a3a7653853f 100644
--- a/Documentation/Configure.help
+++ b/Documentation/Configure.help
@@ -28820,6 +28820,7 @@ CONFIG_SCx200_I2C_SDA
NatSemi SCx200 ACCESS.bus
CONFIG_SCx200_ACB
Enable the use of the ACCESS.bus controllers of a SCx200 processor.
+ It also enables the I2C controller found on Geode GX/LX processors.
If you don't know what to do here, say N.
diff --git a/drivers/i2c/scx200_acb.c b/drivers/i2c/scx200_acb.c
index 677186b43f764c..40916437577434 100644
--- a/drivers/i2c/scx200_acb.c
+++ b/drivers/i2c/scx200_acb.c
@@ -3,6 +3,7 @@
Copyright (c) 2001,2002 Christer Weinigel <wingel@nano-system.com>
National Semiconductor SCx200 ACCESS.bus support
+ Also supports AMD CS5535 and AMD CS5536
Based on i2c-keywest.c which is:
Copyright (c) 2001 Benjamin Herrenschmidt <benh@kernel.crashing.org>
@@ -34,6 +35,7 @@
#include <linux/smp_lock.h>
#include <linux/pci.h>
#include <asm/io.h>
+#include <asm/msr.h>
#include <linux/scx200.h>
@@ -526,24 +528,49 @@ static int __init scx200_acb_create(int base, int index)
return rc;
}
+#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(smb_base, 0);
+}
+
static int __init scx200_acb_init(void)
{
int i;
- int rc;
+ int rc = -ENODEV;
printk(KERN_DEBUG NAME ": NatSemi SCx200 ACCESS.bus Driver\n");
/* Verify that this really is a SCx200 processor */
if (pci_find_device(PCI_VENDOR_ID_NS,
PCI_DEVICE_ID_NS_SCx200_BRIDGE,
- NULL) == NULL)
- return -ENODEV;
-
- rc = -ENXIO;
+ NULL)) {
for (i = 0; i < MAX_DEVICES; ++i) {
if (base[i] > 0)
rc = scx200_acb_create(base[i], i);
}
+ } else if (pci_find_device(PCI_VENDOR_ID_NS,
+ PCI_DEVICE_ID_NS_CS5535_ISA, NULL) ||
+ pci_find_device(PCI_VENDOR_ID_AMD,
+ PCI_DEVICE_ID_AMD_CS5536_ISA, NULL)) {
+ rc = scx200_add_cs553x();
+ }
if (scx200_acb_list)
return 0;
return rc;