aboutsummaryrefslogtreecommitdiffstats
path: root/i2c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2006-05-01 22:43:37 -0700
committerGreg Kroah-Hartman <gregkh@suse.de>2006-05-01 22:43:37 -0700
commitde68488eebf4191d07dad2802b458a08f73f0e58 (patch)
tree1fbba462c8708216f6e60336f3c6e201523ecb41 /i2c
parent0122ac03f9cea48e9120a796d1a315bd833adc7e (diff)
downloadpatches-de68488eebf4191d07dad2802b458a08f73f0e58.tar.gz
i2c fixes
Diffstat (limited to 'i2c')
-rw-r--r--i2c/i2c-scx200_acb-fix-for-cs5535-errata.patch59
-rw-r--r--i2c/i2c-scx200_acb-fix-resource-name-use-after-free.patch45
-rw-r--r--i2c/i2c-scx200_acb-fix-return-on-init-error.patch36
3 files changed, 140 insertions, 0 deletions
diff --git a/i2c/i2c-scx200_acb-fix-for-cs5535-errata.patch b/i2c/i2c-scx200_acb-fix-for-cs5535-errata.patch
new file mode 100644
index 00000000000000..1aa63fe2290bbe
--- /dev/null
+++ b/i2c/i2c-scx200_acb-fix-for-cs5535-errata.patch
@@ -0,0 +1,59 @@
+From khali@linux-fr.org Fri Apr 28 13:53:26 2006
+Date: Fri, 28 Apr 2006 22:53:30 +0200
+From: Jean Delvare <khali@linux-fr.org>
+To: Greg KH <greg@kroah.com>
+Cc: Jordan Crouse <jordan.crouse@amd.com>
+Subject: [PATCH] scx200_acb: Fix for the CS5535 errata
+Message-Id: <20060428225330.8f95903f.khali@linux-fr.org>
+Content-Disposition: inline; filename=i2c-scx200_acb-fix-for-cs5535-errata.patch
+
+From: Jordan Crouse <jordan.crouse@amd.com>
+
+This is a fix for the CS5535 errata 111:
+
+When the SMBus controller tries to access a non-existing device, it sets
+the NEGACK bit, SMBus I/O offset 01h[4], to 1 after it detects no
+acknowledge at the ninth clock. The specification states that the bit
+can be cleared by writing a 1 to it, but under certain circumstances it
+is possible for this bit to not clear.
+
+Writing a 0 to the bit resets the internal state machine and clears the
+issue.
+
+Since all writable bits in ACBST are W1C bits (write-one-to-clear) the
+second write doesn't affect any other logic except the buggy NEGACK
+state machine. The second write clears an internal register which is
+responsible for "overwriting" the NEGACK bit in ACBST.
+
+Signed-off-by: Jordan Crouse <jordan.crouse@amd.com>
+Signed-off-by: Andrew Morton <akpm@osdl.org>
+Signed-off-by: Jean Delvare <khali@linux-fr.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/i2c/busses/scx200_acb.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+--- gregkh-2.6.orig/drivers/i2c/busses/scx200_acb.c
++++ gregkh-2.6/drivers/i2c/busses/scx200_acb.c
+@@ -133,6 +133,9 @@ static void scx200_acb_machine(struct sc
+
+ outb(inb(ACBCTL1) | ACBCTL1_STOP, ACBCTL1);
+ outb(ACBST_STASTR | ACBST_NEGACK, ACBST);
++
++ /* Reset the status register */
++ outb(0, ACBST);
+ return;
+ }
+
+@@ -228,6 +231,10 @@ static void scx200_acb_poll(struct scx20
+ timeout = jiffies + POLL_TIMEOUT;
+ while (time_before(jiffies, timeout)) {
+ status = inb(ACBST);
++
++ /* Reset the status register to avoid the hang */
++ outb(0, ACBST);
++
+ if ((status & (ACBST_SDAST|ACBST_BER|ACBST_NEGACK)) != 0) {
+ scx200_acb_machine(iface, status);
+ return;
diff --git a/i2c/i2c-scx200_acb-fix-resource-name-use-after-free.patch b/i2c/i2c-scx200_acb-fix-resource-name-use-after-free.patch
new file mode 100644
index 00000000000000..9a1e07b0eb5631
--- /dev/null
+++ b/i2c/i2c-scx200_acb-fix-resource-name-use-after-free.patch
@@ -0,0 +1,45 @@
+From khali@linux-fr.org Wed Apr 26 14:00:15 2006
+Date: Wed, 26 Apr 2006 23:00:16 +0200
+From: Jean Delvare <khali@linux-fr.org>
+To: Greg KH <greg@kroah.com>
+Cc: LM Sensors <lm-sensors@lm-sensors.org>
+Subject: scx200_acb: Fix resource name use after free
+Message-Id: <20060426230016.dca44e58.khali@linux-fr.org>
+Content-Disposition: inline; filename=i2c-scx200_acb-fix-resource-name-use-after-free.patch
+
+We can't pass a string on the stack to request_region. As soon as we
+leave the function that stack is gone and the string is lost. Let's
+use the same string we identify the i2c_adapter with instead, it's
+more simple, more consistent, and just works.
+
+This is the second half of fix to bug #6445.
+
+Signed-off-by: Jean Delvare <khali@linux-fr.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/i2c/busses/scx200_acb.c | 6 +-----
+ 1 file changed, 1 insertion(+), 5 deletions(-)
+
+--- gregkh-2.6.orig/drivers/i2c/busses/scx200_acb.c
++++ gregkh-2.6/drivers/i2c/busses/scx200_acb.c
+@@ -415,7 +415,6 @@ static int __init scx200_acb_create(con
+ struct scx200_acb_iface *iface;
+ struct i2c_adapter *adapter;
+ int rc;
+- char description[64];
+
+ iface = kzalloc(sizeof(*iface), GFP_KERNEL);
+ if (!iface) {
+@@ -434,10 +433,7 @@ static int __init scx200_acb_create(con
+
+ mutex_init(&iface->mutex);
+
+- snprintf(description, sizeof(description), "%s ACCESS.bus [%s]",
+- text, adapter->name);
+-
+- if (request_region(base, 8, description) == 0) {
++ if (!request_region(base, 8, adapter->name)) {
+ printk(KERN_ERR NAME ": can't allocate io 0x%x-0x%x\n",
+ base, base + 8-1);
+ rc = -EBUSY;
diff --git a/i2c/i2c-scx200_acb-fix-return-on-init-error.patch b/i2c/i2c-scx200_acb-fix-return-on-init-error.patch
new file mode 100644
index 00000000000000..83692807c7df21
--- /dev/null
+++ b/i2c/i2c-scx200_acb-fix-return-on-init-error.patch
@@ -0,0 +1,36 @@
+From khali@linux-fr.org Wed Apr 26 13:50:30 2006
+Date: Wed, 26 Apr 2006 22:50:32 +0200
+From: Jean Delvare <khali@linux-fr.org>
+To: Greg KH <greg@kroah.com>
+Cc: Ben Gardner <bgardner@wabtec.com>
+Subject: [PATCH] scx200_acb: Fix return on init error
+Message-Id: <20060426225032.12794c0d.khali@linux-fr.org>
+Content-Disposition: inline; filename=i2c-scx200_acb-fix-return-on-init-error.patch
+
+The scx200_acb driver shouldn't return failure after initialization
+if it successfully registered at least one i2c_adapter, else we are
+leaking resources. The driver was OK in that respect up to 2.6.16, a
+recent change broke it.
+
+This is part of the fix to bug #6445.
+
+Signed-off-by: Jean Delvare <khali@linux-fr.org>
+Cc: Ben Gardner <bgardner@wabtec.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/i2c/busses/scx200_acb.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- gregkh-2.6.orig/drivers/i2c/busses/scx200_acb.c
++++ gregkh-2.6/drivers/i2c/busses/scx200_acb.c
+@@ -524,6 +524,9 @@ static int __init scx200_acb_init(void)
+ } else if (pci_dev_present(divil_pci))
+ rc = scx200_add_cs553x();
+
++ /* If at least one bus was created, init must succeed */
++ if (scx200_acb_list)
++ return 0;
+ return rc;
+ }
+