diff options
author | Greg KH <greg@press.(none)> | 2005-10-12 11:09:21 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-10-12 11:09:21 -0700 |
commit | 9ee780b0b0ca3a7757c452e7658a348434639898 (patch) | |
tree | 3bfe251b570d34686cf13454e7a3222021cf98c1 /i2c | |
parent | 1c8778dcd9e742785ec983f49141ec4031ae64c9 (diff) | |
download | patches-9ee780b0b0ca3a7757c452e7658a348434639898.tar.gz |
more i2c patches
Diffstat (limited to 'i2c')
-rw-r--r-- | i2c/i2c-01.patch | 60 | ||||
-rw-r--r-- | i2c/i2c-02.patch | 32 | ||||
-rw-r--r-- | i2c/i2c-03.patch | 64 | ||||
-rw-r--r-- | i2c/i2c-04.patch | 147 | ||||
-rw-r--r-- | i2c/i2c-05.patch | 113 | ||||
-rw-r--r-- | i2c/i2c-06.patch | 66 | ||||
-rw-r--r-- | i2c/i2c-07.patch | 31 | ||||
-rw-r--r-- | i2c/i2c-08.patch | 34 | ||||
-rw-r--r-- | i2c/i2c-09.patch | 142 | ||||
-rw-r--r-- | i2c/i2c-10.patch | 44 | ||||
-rw-r--r-- | i2c/i2c-11.patch | 53 | ||||
-rw-r--r-- | i2c/i2c-12.patch | 75 | ||||
-rw-r--r-- | i2c/i2c-13.patch | 46 | ||||
-rw-r--r-- | i2c/i2c-14.patch | 54 | ||||
-rw-r--r-- | i2c/i2c-15.patch | 170 | ||||
-rw-r--r-- | i2c/i2c-16.patch | 237 |
16 files changed, 1368 insertions, 0 deletions
diff --git a/i2c/i2c-01.patch b/i2c/i2c-01.patch new file mode 100644 index 0000000000000..e46a9fefd7729 --- /dev/null +++ b/i2c/i2c-01.patch @@ -0,0 +1,60 @@ +From khali@linux-fr.org Fri Oct 7 14:05:12 2005 +Date: Fri, 7 Oct 2005 23:04:48 +0200 +From: Jean Delvare <khali@linux-fr.org> +To: Greg KH <greg@kroah.com> +Subject: [PATCH 01/16] i2c: Add missing i2c-ixp2000/4xx adapter name +Message-Id: <20051007230448.595f1993.khali@linux-fr.org> + +The ixp4xx and ixp2000 i2c bus drivers omit to fill the required +i2c_adapter name field. Copy the device driver name field there. + +Signed-off-by: Jean Delvare <khali@linux-fr.org> +Signed-off-by: Deepak Saxena <dsaxena@plexity.net> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + + +--- + drivers/i2c/busses/i2c-ixp2000.c | 4 ++++ + drivers/i2c/busses/i2c-ixp4xx.c | 4 ++++ + 2 files changed, 8 insertions(+) + +--- gregkh-2.6.orig/drivers/i2c/busses/i2c-ixp4xx.c ++++ gregkh-2.6/drivers/i2c/busses/i2c-ixp4xx.c +@@ -35,6 +35,8 @@ + + #include <asm/hardware.h> /* Pick up IXP4xx-specific bits */ + ++static struct device_driver ixp4xx_i2c_driver; ++ + static inline int ixp4xx_scl_pin(void *data) + { + return ((struct ixp4xx_i2c_pins*)data)->scl_pin; +@@ -129,6 +131,8 @@ static int ixp4xx_i2c_probe(struct devic + drv_data->algo_data.timeout = 100; + + drv_data->adapter.id = I2C_HW_B_IXP4XX; ++ strlcpy(drv_data->adapter.name, ixp4xx_i2c_driver.name, ++ I2C_NAME_SIZE); + drv_data->adapter.algo_data = &drv_data->algo_data; + + drv_data->adapter.dev.parent = &plat_dev->dev; +--- gregkh-2.6.orig/drivers/i2c/busses/i2c-ixp2000.c ++++ gregkh-2.6/drivers/i2c/busses/i2c-ixp2000.c +@@ -36,6 +36,8 @@ + #include <asm/hardware.h> /* Pick up IXP2000-specific bits */ + #include <asm/arch/gpio.h> + ++static struct device_driver ixp2000_i2c_driver; ++ + static inline int ixp2000_scl_pin(void *data) + { + return ((struct ixp2000_i2c_pins*)data)->scl_pin; +@@ -121,6 +123,8 @@ static int ixp2000_i2c_probe(struct devi + drv_data->algo_data.timeout = 100; + + drv_data->adapter.id = I2C_HW_B_IXP2000, ++ strlcpy(drv_data->adapter.name, ixp2000_i2c_driver.name, ++ I2C_NAME_SIZE); + drv_data->adapter.algo_data = &drv_data->algo_data, + + drv_data->adapter.dev.parent = &plat_dev->dev; diff --git a/i2c/i2c-02.patch b/i2c/i2c-02.patch new file mode 100644 index 0000000000000..4497a5c6ea28f --- /dev/null +++ b/i2c/i2c-02.patch @@ -0,0 +1,32 @@ +From khali@linux-fr.org Fri Oct 7 14:10:24 2005 +Date: Fri, 7 Oct 2005 23:06:27 +0200 +From: Jean Delvare <khali@linux-fr.org> +To: Greg KH <greg@kroah.com> +Subject: [PATCH 02/16] i2c: Cleanup i2c-dev ioctl debug message +Message-Id: <20051007230627.1eba9aee.khali@linux-fr.org> + +Cleanup the ioctl debug message in i2c-dev. In particular, the minor +number is redundant now that the minor number and the adapter number +are kept in sync. + +Signed-off-by: Jean Delvare <khali@linux-fr.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + + +--- + drivers/i2c/i2c-dev.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- gregkh-2.6.orig/drivers/i2c/i2c-dev.c ++++ gregkh-2.6/drivers/i2c/i2c-dev.c +@@ -176,8 +176,8 @@ static int i2cdev_ioctl(struct inode *in + int i,datasize,res; + unsigned long funcs; + +- dev_dbg(&client->adapter->dev, "i2c-%d ioctl, cmd: 0x%x, arg: %lx.\n", +- iminor(inode),cmd, arg); ++ dev_dbg(&client->adapter->dev, "ioctl, cmd=0x%02x, arg=0x%02lx\n", ++ cmd, arg); + + switch ( cmd ) { + case I2C_SLAVE: diff --git a/i2c/i2c-03.patch b/i2c/i2c-03.patch new file mode 100644 index 0000000000000..9950567d2a27a --- /dev/null +++ b/i2c/i2c-03.patch @@ -0,0 +1,64 @@ +From khali@linux-fr.org Fri Oct 7 14:10:33 2005 +Date: Fri, 7 Oct 2005 23:09:04 +0200 +From: Jean Delvare <khali@linux-fr.org> +To: Greg KH <greg@kroah.com> +Subject: [PATCH 03/16] i2c: Drop useless CVS revision IDs +Message-Id: <20051007230904.1a956707.khali@linux-fr.org> + +CVS revision IDs are totally useless and irrelevant by now. + +Signed-off-by: Jean Delvare <khali@linux-fr.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + + +--- + include/linux/i2c-algo-bit.h | 2 -- + include/linux/i2c-algo-pcf.h | 2 -- + include/linux/i2c-dev.h | 2 -- + include/linux/i2c.h | 2 -- + 4 files changed, 8 deletions(-) + +--- gregkh-2.6.orig/include/linux/i2c-algo-bit.h ++++ gregkh-2.6/include/linux/i2c-algo-bit.h +@@ -21,8 +21,6 @@ + /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even + Frodo Looijaard <frodol@dds.nl> */ + +-/* $Id: i2c-algo-bit.h,v 1.10 2003/01/21 08:08:16 kmalkki Exp $ */ +- + #ifndef _LINUX_I2C_ALGO_BIT_H + #define _LINUX_I2C_ALGO_BIT_H + +--- gregkh-2.6.orig/include/linux/i2c-algo-pcf.h ++++ gregkh-2.6/include/linux/i2c-algo-pcf.h +@@ -22,8 +22,6 @@ + /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even + Frodo Looijaard <frodol@dds.nl> */ + +-/* $Id: i2c-algo-pcf.h,v 1.8 2003/01/21 08:08:16 kmalkki Exp $ */ +- + #ifndef _LINUX_I2C_ALGO_PCF_H + #define _LINUX_I2C_ALGO_PCF_H + +--- gregkh-2.6.orig/include/linux/i2c-dev.h ++++ gregkh-2.6/include/linux/i2c-dev.h +@@ -19,8 +19,6 @@ + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +-/* $Id: i2c-dev.h,v 1.13 2003/01/21 08:08:16 kmalkki Exp $ */ +- + #ifndef _LINUX_I2C_DEV_H + #define _LINUX_I2C_DEV_H + +--- gregkh-2.6.orig/include/linux/i2c.h ++++ gregkh-2.6/include/linux/i2c.h +@@ -23,8 +23,6 @@ + /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and + Frodo Looijaard <frodol@dds.nl> */ + +-/* $Id: i2c.h,v 1.68 2003/01/21 08:08:16 kmalkki Exp $ */ +- + #ifndef _LINUX_I2C_H + #define _LINUX_I2C_H + diff --git a/i2c/i2c-04.patch b/i2c/i2c-04.patch new file mode 100644 index 0000000000000..1546068bf7fe6 --- /dev/null +++ b/i2c/i2c-04.patch @@ -0,0 +1,147 @@ +From khali@linux-fr.org Fri Oct 7 14:15:46 2005 +Date: Fri, 7 Oct 2005 23:11:03 +0200 +From: Jean Delvare <khali@linux-fr.org> +To: Greg KH <greg@kroah.com> +Subject: [PATCH 04/16] hwmon: Fix w83627ehf/hf vs PNPACPI conflict (bug #4014) +Message-Id: <20051007231103.71e6b2d6.khali@linux-fr.org> + +From: Petr Vandrovec <vandrove@vc.cvut.cz> + +This patch changes w83627hf and w83627ehf drivers to reserve only ports +0x295-0x296, instead of full 0x290-0x297 range. While some other +sensors chips respond to all addresses in 0x290-0x297 range, Winbond +chips respond to 0x295-0x296 only (this behavior is implied by +documentation, and matches behavior observed on real systems). This is +not problem alone, as no BIOS was found to put something at these unused +addresses, and sensors chip itself provides nothing there as well. + +But in addition to only respond to these two addresses, also BIOS +vendors report in their ACPI-PnP structures that there is some resource +at I/O address 0x295 of length 2. And when later this hwmon driver +attempts to request region with base 0x290/length 8, it fails as one +request_region cannot span more than one device. + +Due to this we have to ask only for region this hardware really +occupies, otherwise driver cannot be loaded on systems with ACPI-PnP +enabled. + +Signed-off-by: Petr Vandrovec <vandrove@vc.cvut.cz> +Signed-off-by: Jean Delvare <khali@linux-fr.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + + +--- + drivers/hwmon/w83627ehf.c | 13 ++++++++----- + drivers/hwmon/w83627hf.c | 21 +++++++++++++-------- + 2 files changed, 21 insertions(+), 13 deletions(-) + +--- gregkh-2.6.orig/drivers/hwmon/w83627ehf.c ++++ gregkh-2.6/drivers/hwmon/w83627ehf.c +@@ -105,7 +105,9 @@ superio_exit(void) + * ISA constants + */ + +-#define REGION_LENGTH 8 ++#define REGION_ALIGNMENT ~7 ++#define REGION_OFFSET 5 ++#define REGION_LENGTH 2 + #define ADDR_REG_OFFSET 5 + #define DATA_REG_OFFSET 6 + +@@ -673,7 +675,8 @@ static int w83627ehf_detect(struct i2c_a + struct w83627ehf_data *data; + int i, err = 0; + +- if (!request_region(address, REGION_LENGTH, w83627ehf_driver.name)) { ++ if (!request_region(address + REGION_OFFSET, REGION_LENGTH, ++ w83627ehf_driver.name)) { + err = -EBUSY; + goto exit; + } +@@ -762,7 +765,7 @@ exit_detach: + exit_free: + kfree(data); + exit_release: +- release_region(address, REGION_LENGTH); ++ release_region(address + REGION_OFFSET, REGION_LENGTH); + exit: + return err; + } +@@ -776,7 +779,7 @@ static int w83627ehf_detach_client(struc + + if ((err = i2c_detach_client(client))) + return err; +- release_region(client->addr, REGION_LENGTH); ++ release_region(client->addr + REGION_OFFSET, REGION_LENGTH); + kfree(data); + + return 0; +@@ -807,7 +810,7 @@ static int __init w83627ehf_find(int sio + superio_select(W83627EHF_LD_HWM); + val = (superio_inb(SIO_REG_ADDR) << 8) + | superio_inb(SIO_REG_ADDR + 1); +- *addr = val & ~(REGION_LENGTH - 1); ++ *addr = val & REGION_ALIGNMENT; + if (*addr == 0) { + superio_exit(); + return -ENODEV; +--- gregkh-2.6.orig/drivers/hwmon/w83627hf.c ++++ gregkh-2.6/drivers/hwmon/w83627hf.c +@@ -142,10 +142,14 @@ superio_exit(void) + #define WINB_BASE_REG 0x60 + /* Constants specified below */ + +-/* Length of ISA address segment */ +-#define WINB_EXTENT 8 ++/* Alignment of the base address */ ++#define WINB_ALIGNMENT ~7 + +-/* Where are the ISA address/data registers relative to the base address */ ++/* Offset & size of I/O region we are interested in */ ++#define WINB_REGION_OFFSET 5 ++#define WINB_REGION_SIZE 2 ++ ++/* Where are the sensors address/data registers relative to the base address */ + #define W83781D_ADDR_REG_OFFSET 5 + #define W83781D_DATA_REG_OFFSET 6 + +@@ -981,7 +985,7 @@ static int __init w83627hf_find(int sioa + superio_select(W83627HF_LD_HWM); + val = (superio_inb(WINB_BASE_REG) << 8) | + superio_inb(WINB_BASE_REG + 1); +- *addr = val & ~(WINB_EXTENT - 1); ++ *addr = val & WINB_ALIGNMENT; + if (*addr == 0 && force_addr == 0) { + superio_exit(); + return -ENODEV; +@@ -1000,9 +1004,10 @@ static int w83627hf_detect(struct i2c_ad + const char *client_name = ""; + + if(force_addr) +- address = force_addr & ~(WINB_EXTENT - 1); ++ address = force_addr & WINB_ALIGNMENT; + +- if (!request_region(address, WINB_EXTENT, w83627hf_driver.name)) { ++ if (!request_region(address + WINB_REGION_OFFSET, WINB_REGION_SIZE, ++ w83627hf_driver.name)) { + err = -EBUSY; + goto ERROR0; + } +@@ -1148,7 +1153,7 @@ static int w83627hf_detect(struct i2c_ad + ERROR2: + kfree(data); + ERROR1: +- release_region(address, WINB_EXTENT); ++ release_region(address + WINB_REGION_OFFSET, WINB_REGION_SIZE); + ERROR0: + return err; + } +@@ -1163,7 +1168,7 @@ static int w83627hf_detach_client(struct + if ((err = i2c_detach_client(client))) + return err; + +- release_region(client->addr, WINB_EXTENT); ++ release_region(client->addr + WINB_REGION_OFFSET, WINB_REGION_SIZE); + kfree(data); + + return 0; diff --git a/i2c/i2c-05.patch b/i2c/i2c-05.patch new file mode 100644 index 0000000000000..acbc81e9734db --- /dev/null +++ b/i2c/i2c-05.patch @@ -0,0 +1,113 @@ +From khali@linux-fr.org Fri Oct 7 14:58:33 2005 +Date: Fri, 7 Oct 2005 23:56:46 +0200 +From: Jean Delvare <khali@linux-fr.org> +To: Greg KH <greg@kroah.com> +Subject: [PATCH 05/16] i2c: Cleanup i2c-i801 ifdefs +Message-Id: <20051007235646.22706935.khali@linux-fr.org> + +No more need to check for PEC support being available now that both +the i2c-core and the i2c-i801 drivers are part of the Linux kernel +source tree. It's just there. + +Signed-off-by: Jean Delvare <khali@linux-fr.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + + +--- + drivers/i2c/busses/i2c-i801.c | 20 +------------------- + 1 file changed, 1 insertion(+), 19 deletions(-) + +--- gregkh-2.6.orig/drivers/i2c/busses/i2c-i801.c ++++ gregkh-2.6/drivers/i2c/busses/i2c-i801.c +@@ -52,10 +52,6 @@ + #include <linux/i2c.h> + #include <asm/io.h> + +-#ifdef I2C_FUNC_SMBUS_BLOCK_DATA_PEC +-#define HAVE_PEC +-#endif +- + /* I801 SMBus address offsets */ + #define SMBHSTSTS (0 + i801_smba) + #define SMBHSTCNT (2 + i801_smba) +@@ -392,7 +388,6 @@ static int i801_block_transaction(union + goto END; + } + +-#ifdef HAVE_PEC + if(isich4 && command == I2C_SMBUS_BLOCK_DATA_PEC) { + /* wait for INTR bit as advised by Intel */ + timeout = 0; +@@ -407,7 +402,6 @@ static int i801_block_transaction(union + } + outb_p(temp, SMBHSTSTS); + } +-#endif + result = 0; + END: + if (command == I2C_SMBUS_I2C_BLOCK_DATA) { +@@ -426,10 +420,8 @@ static s32 i801_access(struct i2c_adapte + int block = 0; + int ret, xact = 0; + +-#ifdef HAVE_PEC + if(isich4) + hwpec = (flags & I2C_CLIENT_PEC) != 0; +-#endif + + switch (size) { + case I2C_SMBUS_QUICK: +@@ -464,11 +456,9 @@ static s32 i801_access(struct i2c_adapte + break; + case I2C_SMBUS_BLOCK_DATA: + case I2C_SMBUS_I2C_BLOCK_DATA: +-#ifdef HAVE_PEC + case I2C_SMBUS_BLOCK_DATA_PEC: + if(hwpec && size == I2C_SMBUS_BLOCK_DATA) + size = I2C_SMBUS_BLOCK_DATA_PEC; +-#endif + outb_p(((addr & 0x7f) << 1) | (read_write & 0x01), + SMBHSTADD); + outb_p(command, SMBHSTCMD); +@@ -480,13 +470,11 @@ static s32 i801_access(struct i2c_adapte + return -1; + } + +-#ifdef HAVE_PEC + if(isich4 && hwpec) { + if(size != I2C_SMBUS_QUICK && + size != I2C_SMBUS_I2C_BLOCK_DATA) + outb_p(1, SMBAUXCTL); /* enable HW PEC */ + } +-#endif + if(block) + ret = i801_block_transaction(data, read_write, size); + else { +@@ -494,13 +482,11 @@ static s32 i801_access(struct i2c_adapte + ret = i801_transaction(); + } + +-#ifdef HAVE_PEC + if(isich4 && hwpec) { + if(size != I2C_SMBUS_QUICK && + size != I2C_SMBUS_I2C_BLOCK_DATA) + outb_p(0, SMBAUXCTL); + } +-#endif + + if(block) + return ret; +@@ -527,12 +513,8 @@ static u32 i801_func(struct i2c_adapter + return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | + I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA | + I2C_FUNC_SMBUS_BLOCK_DATA | I2C_FUNC_SMBUS_WRITE_I2C_BLOCK +-#ifdef HAVE_PEC + | (isich4 ? I2C_FUNC_SMBUS_BLOCK_DATA_PEC | +- I2C_FUNC_SMBUS_HWPEC_CALC +- : 0) +-#endif +- ; ++ I2C_FUNC_SMBUS_HWPEC_CALC : 0); + } + + static struct i2c_algorithm smbus_algorithm = { diff --git a/i2c/i2c-06.patch b/i2c/i2c-06.patch new file mode 100644 index 0000000000000..d823dbe149c03 --- /dev/null +++ b/i2c/i2c-06.patch @@ -0,0 +1,66 @@ +From khali@linux-fr.org Fri Oct 7 15:04:10 2005 +Date: Sat, 8 Oct 2005 00:00:31 +0200 +From: Jean Delvare <khali@linux-fr.org> +To: Greg KH <greg@kroah.com> +Subject: [PATCH 06/16] i2c: Documentation fixes +Message-Id: <20051008000031.60fb7f18.khali@linux-fr.org> + +i2c documentation fixes. + +>From Hideki Iwamoto: +* i2c_smbus_read_i2c_block_data is not deleted in 2.6.10. It still + exists. +* The name which can be set to i2c_driver is up to 31 characters. + +>From Jean Delvare: +* Reword the paragraph about i2c_driver.name, to reflect the "new" + naming policy. +* Delete the out-of-date note about now gone inc_use and dec_use + fields. + +Signed-off-by: Jean Delvare <khali@linux-fr.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + + +--- + Documentation/i2c/writing-clients | 11 ++++------- + 1 file changed, 4 insertions(+), 7 deletions(-) + +--- gregkh-2.6.orig/Documentation/i2c/writing-clients ++++ gregkh-2.6/Documentation/i2c/writing-clients +@@ -33,8 +33,8 @@ static struct i2c_driver foo_driver = { + .command = &foo_command /* may be NULL */ + } + +-The name can be chosen freely, and may be upto 40 characters long. Please +-use something descriptive here. ++The name field must match the driver name, including the case. It must not ++contain spaces, and may be up to 31 characters long. + + Don't worry about the flags field; just put I2C_DF_NOTIFY into it. This + means that your driver will be notified when new adapters are found. +@@ -43,9 +43,6 @@ This is almost always what you want. + All other fields are for call-back functions which will be explained + below. + +-There use to be two additional fields in this structure, inc_use et dec_use, +-for module usage count, but these fields were obsoleted and removed. +- + + Extra client data + ================= +@@ -576,12 +573,12 @@ SMBus communication + extern s32 i2c_smbus_write_block_data(struct i2c_client * client, + u8 command, u8 length, + u8 *values); ++ extern s32 i2c_smbus_read_i2c_block_data(struct i2c_client * client, ++ u8 command, u8 *values); + + These ones were removed in Linux 2.6.10 because they had no users, but could + be added back later if needed: + +- extern s32 i2c_smbus_read_i2c_block_data(struct i2c_client * client, +- u8 command, u8 *values); + extern s32 i2c_smbus_read_block_data(struct i2c_client * client, + u8 command, u8 *values); + extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client * client, diff --git a/i2c/i2c-07.patch b/i2c/i2c-07.patch new file mode 100644 index 0000000000000..5d3de7dff1d45 --- /dev/null +++ b/i2c/i2c-07.patch @@ -0,0 +1,31 @@ +From khali@linux-fr.org Fri Oct 7 15:04:37 2005 +Date: Sat, 8 Oct 2005 00:04:13 +0200 +From: Jean Delvare <khali@linux-fr.org> +To: Greg KH <greg@kroah.com> +Subject: [PATCH 07/16] i2c: Fix misplaced i2c.h comment +Message-Id: <20051008000413.2d4f3976.khali@linux-fr.org> + +Fix a misplaced comment in i2c.h. Spotted by Hideki Iwamoto. + +Signed-off-by: Jean Delvare <khali@linux-fr.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + + +--- + include/linux/i2c.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- gregkh-2.6.orig/include/linux/i2c.h ++++ gregkh-2.6/include/linux/i2c.h +@@ -93,10 +93,10 @@ extern s32 i2c_smbus_write_byte_data(str + extern s32 i2c_smbus_read_word_data(struct i2c_client * client, u8 command); + extern s32 i2c_smbus_write_word_data(struct i2c_client * client, + u8 command, u16 value); +-/* Returns the number of bytes transferred */ + extern s32 i2c_smbus_write_block_data(struct i2c_client * client, + u8 command, u8 length, + u8 *values); ++/* Returns the number of read bytes */ + extern s32 i2c_smbus_read_i2c_block_data(struct i2c_client * client, + u8 command, u8 *values); + diff --git a/i2c/i2c-08.patch b/i2c/i2c-08.patch new file mode 100644 index 0000000000000..475dd79b981fb --- /dev/null +++ b/i2c/i2c-08.patch @@ -0,0 +1,34 @@ +From khali@linux-fr.org Fri Oct 7 15:09:47 2005 +Date: Sat, 8 Oct 2005 00:06:09 +0200 +From: Jean Delvare <khali@linux-fr.org> +To: Greg KH <greg@kroah.com> +Subject: [PATCH 08/16] i2c: Drop out-of-date, colliding ioctl definitions +Message-Id: <20051008000609.5846697a.khali@linux-fr.org> + +Delete 2 out-of-date, colliding ioctl defines. I2C_UDELAY and +I2C_MDELAY are supposed to be used by i2c-algo-bit, but actually +aren't (and I suspect never were). Moreover, their values are the same +as I2C_FUNCS and I2C_SLAVE_FORCE, respectively, which *are* widely +used. + +Signed-off-by: Jean Delvare <khali@linux-fr.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + include/linux/i2c.h | 5 ----- + 1 file changed, 5 deletions(-) + +--- gregkh-2.6.orig/include/linux/i2c.h ++++ gregkh-2.6/include/linux/i2c.h +@@ -504,11 +504,6 @@ union i2c_smbus_data { + + #define I2C_SMBUS 0x0720 /* SMBus-level access */ + +-/* ... algo-bit.c recognizes */ +-#define I2C_UDELAY 0x0705 /* set delay in microsecs between each */ +- /* written byte (except address) */ +-#define I2C_MDELAY 0x0706 /* millisec delay between written bytes */ +- + /* ----- I2C-DEV: char device interface stuff ------------------------- */ + + #define I2C_MAJOR 89 /* Device major number */ diff --git a/i2c/i2c-09.patch b/i2c/i2c-09.patch new file mode 100644 index 0000000000000..a1fec4612ea07 --- /dev/null +++ b/i2c/i2c-09.patch @@ -0,0 +1,142 @@ +From khali@linux-fr.org Fri Oct 7 15:10:02 2005 +Date: Sat, 8 Oct 2005 00:10:00 +0200 +From: Jean Delvare <khali@linux-fr.org> +To: Greg KH <greg@kroah.com> +Subject: [PATCH 09/16] hwmon: Drop legacy ISA address support from it87 +Message-Id: <20051008001000.101d39e7.khali@linux-fr.org> + +Drop legacy ISA address support from the it87 driver. All supported +chips are Super-I/O chips, so the device ISA address can be safely read +from Super-I/O space rather than blindly assumed. + +Two nearby inaccurate documentation statements have been fixed as well: +* The IT8705F doesn't have an SMBus interface. +* The SiS950 doesn't have a distinct prefix. + +Signed-off-by: Jean Delvare <khali@linux-fr.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + + +--- + Documentation/hwmon/it87 | 8 +++---- + drivers/hwmon/it87.c | 51 ++++++++++------------------------------------- + 2 files changed, 15 insertions(+), 44 deletions(-) + +--- gregkh-2.6.orig/drivers/hwmon/it87.c ++++ gregkh-2.6/drivers/hwmon/it87.c +@@ -2,7 +2,7 @@ + it87.c - Part of lm_sensors, Linux kernel modules for hardware + monitoring. + +- Supports: IT8705F Super I/O chip w/LPC interface & SMBus ++ Supports: IT8705F Super I/O chip w/LPC interface + IT8712F Super I/O chip w/LPC interface & SMBus + Sis950 A clone of the IT8705F + +@@ -47,7 +47,7 @@ + /* Addresses to scan */ + static unsigned short normal_i2c[] = { 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, + 0x2e, 0x2f, I2C_CLIENT_END }; +-static unsigned short isa_address = 0x290; ++static unsigned short isa_address; + + /* Insmod parameters */ + I2C_CLIENT_INSMOD_2(it87, it8712); +@@ -706,7 +706,7 @@ static int it87_isa_attach_adapter(struc + } + + /* SuperIO detection - will change isa_address if a chip is found */ +-static int __init it87_find(int *address) ++static int __init it87_find(unsigned short *address) + { + int err = -ENODEV; + +@@ -757,34 +757,7 @@ int it87_detect(struct i2c_adapter *adap + if (!request_region(address, IT87_EXTENT, it87_isa_driver.name)) + goto ERROR0; + +- /* Probe whether there is anything available on this address. Already +- done for SMBus and Super-I/O clients */ +- if (kind < 0) { +- if (is_isa && !chip_type) { +-#define REALLY_SLOW_IO +- /* We need the timeouts for at least some IT87-like chips. But only +- if we read 'undefined' registers. */ +- i = inb_p(address + 1); +- if (inb_p(address + 2) != i +- || inb_p(address + 3) != i +- || inb_p(address + 7) != i) { +- err = -ENODEV; +- goto ERROR1; +- } +-#undef REALLY_SLOW_IO +- +- /* Let's just hope nothing breaks here */ +- i = inb_p(address + 5) & 0x7f; +- outb_p(~i & 0x7f, address + 5); +- if ((inb_p(address + 5) & 0x7f) != (~i & 0x7f)) { +- outb_p(i, address + 5); +- err = -ENODEV; +- goto ERROR1; +- } +- } +- } +- +- /* OK. For now, we presume we have a valid client. We now create the ++ /* For now, we presume we have a valid client. We create the + client structure, even though we cannot fill it completely yet. + But it allows us to access it87_{read,write}_value. */ + +@@ -1182,20 +1155,18 @@ static struct it87_data *it87_update_dev + + static int __init sm_it87_init(void) + { +- int addr, res; +- +- if (!it87_find(&addr)) { +- isa_address = addr; +- } ++ int res; + + res = i2c_add_driver(&it87_driver); + if (res) + return res; + +- res = i2c_isa_add_driver(&it87_isa_driver); +- if (res) { +- i2c_del_driver(&it87_driver); +- return res; ++ if (!it87_find(&isa_address)) { ++ res = i2c_isa_add_driver(&it87_isa_driver); ++ if (res) { ++ i2c_del_driver(&it87_driver); ++ return res; ++ } + } + + return 0; +--- gregkh-2.6.orig/Documentation/hwmon/it87 ++++ gregkh-2.6/Documentation/hwmon/it87 +@@ -4,18 +4,18 @@ Kernel driver it87 + Supported chips: + * IT8705F + Prefix: 'it87' +- Addresses scanned: from Super I/O config space, or default ISA 0x290 (8 I/O ports) ++ Addresses scanned: from Super I/O config space (8 I/O ports) + Datasheet: Publicly available at the ITE website + http://www.ite.com.tw/ + * IT8712F + Prefix: 'it8712' + Addresses scanned: I2C 0x28 - 0x2f +- from Super I/O config space, or default ISA 0x290 (8 I/O ports) ++ from Super I/O config space (8 I/O ports) + Datasheet: Publicly available at the ITE website + http://www.ite.com.tw/ + * SiS950 [clone of IT8705F] +- Prefix: 'sis950' +- Addresses scanned: from Super I/O config space, or default ISA 0x290 (8 I/O ports) ++ Prefix: 'it87' ++ Addresses scanned: from Super I/O config space (8 I/O ports) + Datasheet: No longer be available + + Author: Christophe Gauthron <chrisg@0-in.com> diff --git a/i2c/i2c-10.patch b/i2c/i2c-10.patch new file mode 100644 index 0000000000000..2fd95678582c4 --- /dev/null +++ b/i2c/i2c-10.patch @@ -0,0 +1,44 @@ +From khali@linux-fr.org Fri Oct 7 15:15:12 2005 +Date: Sat, 8 Oct 2005 00:12:01 +0200 +From: Jean Delvare <khali@linux-fr.org> +To: Greg KH <greg@kroah.com> +Subject: [PATCH 10/16] hwmon: Drop useless w83627hf initialization step +Message-Id: <20051008001201.33cb9a33.khali@linux-fr.org> + +Drop a useless initialization step in the w83627hf driver. The comment +says that the W83627HF PWM2 can be disabled, but it can't. I suppose +this is a leftover from the w83781d driver (from which the w83627hf +driver is derived), as for example the W83782D had the ability to +disable PWM2. + +Signed-off-by: Jean Delvare <khali@linux-fr.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + + +--- + drivers/hwmon/w83627hf.c | 7 ------- + 1 file changed, 7 deletions(-) + +--- gregkh-2.6.orig/drivers/hwmon/w83627hf.c ++++ gregkh-2.6/drivers/hwmon/w83627hf.c +@@ -201,7 +201,6 @@ superio_exit(void) + + #define W83627HF_REG_PWM1 0x5A + #define W83627HF_REG_PWM2 0x5B +-#define W83627HF_REG_PWMCLK12 0x5C + + #define W83627THF_REG_PWM1 0x01 /* 697HF and 637HF too */ + #define W83627THF_REG_PWM2 0x03 /* 697HF and 637HF too */ +@@ -1373,12 +1372,6 @@ static void w83627hf_init_client(struct + } + } + +- if (type == w83627hf) { +- /* enable PWM2 control (can't hurt since PWM reg +- should have been reset to 0xff) */ +- w83627hf_write_value(client, W83627HF_REG_PWMCLK12, +- 0x19); +- } + /* enable comparator mode for temp2 and temp3 so + alarm indication will work correctly */ + i = w83627hf_read_value(client, W83781D_REG_IRQ); diff --git a/i2c/i2c-11.patch b/i2c/i2c-11.patch new file mode 100644 index 0000000000000..78464f9f693fe --- /dev/null +++ b/i2c/i2c-11.patch @@ -0,0 +1,53 @@ +From khali@linux-fr.org Fri Oct 7 15:15:18 2005 +Date: Sat, 8 Oct 2005 00:14:17 +0200 +From: Jean Delvare <khali@linux-fr.org> +To: Greg KH <greg@kroah.com> +Subject: [PATCH 11/16] i2c: Drop unused per-i2c-algorithm adapter max +Message-Id: <20051008001417.5efb1573.khali@linux-fr.org> + +There are no more per-i2c-algorithm adapter max. Last time there were +was in July 1999. + +Signed-off-by: Jean Delvare <khali@linux-fr.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + + +--- + include/linux/i2c-algo-bit.h | 2 -- + include/linux/i2c-algo-pca.h | 2 -- + include/linux/i2c-algo-pcf.h | 2 -- + 3 files changed, 6 deletions(-) + +--- gregkh-2.6.orig/include/linux/i2c-algo-bit.h ++++ gregkh-2.6/include/linux/i2c-algo-bit.h +@@ -44,8 +44,6 @@ struct i2c_algo_bit_data { + int timeout; /* in jiffies */ + }; + +-#define I2C_BIT_ADAP_MAX 16 +- + int i2c_bit_add_bus(struct i2c_adapter *); + int i2c_bit_del_bus(struct i2c_adapter *); + +--- gregkh-2.6.orig/include/linux/i2c-algo-pca.h ++++ gregkh-2.6/include/linux/i2c-algo-pca.h +@@ -9,8 +9,6 @@ struct i2c_algo_pca_data { + int (*wait_for_interrupt) (struct i2c_algo_pca_data *adap); + }; + +-#define I2C_PCA_ADAP_MAX 16 +- + int i2c_pca_add_bus(struct i2c_adapter *); + int i2c_pca_del_bus(struct i2c_adapter *); + +--- gregkh-2.6.orig/include/linux/i2c-algo-pcf.h ++++ gregkh-2.6/include/linux/i2c-algo-pcf.h +@@ -39,8 +39,6 @@ struct i2c_algo_pcf_data { + int timeout; + }; + +-#define I2C_PCF_ADAP_MAX 16 +- + int i2c_pcf_add_bus(struct i2c_adapter *); + int i2c_pcf_del_bus(struct i2c_adapter *); + diff --git a/i2c/i2c-12.patch b/i2c/i2c-12.patch new file mode 100644 index 0000000000000..302556438a19e --- /dev/null +++ b/i2c/i2c-12.patch @@ -0,0 +1,75 @@ +From khali@linux-fr.org Fri Oct 7 15:20:31 2005 +Date: Sat, 8 Oct 2005 00:15:59 +0200 +From: Jean Delvare <khali@linux-fr.org> +To: Greg KH <greg@kroah.com> +Subject: [PATCH 12/16] i2c: Drop I2C_SMBUS_I2C_BLOCK_MAX +Message-Id: <20051008001559.186209d1.khali@linux-fr.org> + +Drop I2C_SMBUS_I2C_BLOCK_MAX, use I2C_SMBUS_BLOCK_MAX instead. + +I2C_SMBUS_I2C_BLOCK_MAX has always been defined to the same value as +I2C_SMBUS_BLOCK_MAX, and this will never change: setting it to a lower +value would make no sense, setting it to a higher value would break +i2c_smbus_data compatibility. There is no point in changing +i2c_smbus_data to support larger block transactions in SMBus mode, as +no SMBus hardware supports more than 32 byte blocks. Thus, for larger +transactions, direct I2C transfers are the way to go. + +Signed-off-by: Jean Delvare <khali@linux-fr.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/i2c/chips/eeprom.c | 4 ++-- + drivers/i2c/i2c-core.c | 8 ++++---- + include/linux/i2c.h | 1 - + 3 files changed, 6 insertions(+), 7 deletions(-) + +--- gregkh-2.6.orig/drivers/i2c/chips/eeprom.c ++++ gregkh-2.6/drivers/i2c/chips/eeprom.c +@@ -88,8 +88,8 @@ static void eeprom_update_client(struct + dev_dbg(&client->dev, "Starting eeprom update, slice %u\n", slice); + + if (i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_READ_I2C_BLOCK)) { +- for (i = slice << 5; i < (slice + 1) << 5; i += I2C_SMBUS_I2C_BLOCK_MAX) +- if (i2c_smbus_read_i2c_block_data(client, i, data->data + i) != I2C_SMBUS_I2C_BLOCK_MAX) ++ for (i = slice << 5; i < (slice + 1) << 5; i += I2C_SMBUS_BLOCK_MAX) ++ if (i2c_smbus_read_i2c_block_data(client, i, data->data + i) != I2C_SMBUS_BLOCK_MAX) + goto exit; + } else { + if (i2c_smbus_write_byte(client, slice << 5)) { +--- gregkh-2.6.orig/drivers/i2c/i2c-core.c ++++ gregkh-2.6/drivers/i2c/i2c-core.c +@@ -1108,10 +1108,10 @@ static s32 i2c_smbus_xfer_emulated(struc + return -1; + case I2C_SMBUS_I2C_BLOCK_DATA: + if (read_write == I2C_SMBUS_READ) { +- msg[1].len = I2C_SMBUS_I2C_BLOCK_MAX; ++ msg[1].len = I2C_SMBUS_BLOCK_MAX; + } else { + msg[0].len = data->block[0] + 1; +- if (msg[0].len > I2C_SMBUS_I2C_BLOCK_MAX + 1) { ++ if (msg[0].len > I2C_SMBUS_BLOCK_MAX + 1) { + dev_err(&adapter->dev, "i2c_smbus_xfer_emulated called with " + "invalid block write size (%d)\n", + data->block[0]); +@@ -1144,8 +1144,8 @@ static s32 i2c_smbus_xfer_emulated(struc + break; + case I2C_SMBUS_I2C_BLOCK_DATA: + /* fixed at 32 for now */ +- data->block[0] = I2C_SMBUS_I2C_BLOCK_MAX; +- for (i = 0; i < I2C_SMBUS_I2C_BLOCK_MAX; i++) ++ data->block[0] = I2C_SMBUS_BLOCK_MAX; ++ for (i = 0; i < I2C_SMBUS_BLOCK_MAX; i++) + data->block[i+1] = msgbuf1[i]; + break; + } +--- gregkh-2.6.orig/include/linux/i2c.h ++++ gregkh-2.6/include/linux/i2c.h +@@ -449,7 +449,6 @@ struct i2c_msg { + * Data for SMBus Messages + */ + #define I2C_SMBUS_BLOCK_MAX 32 /* As specified in SMBus standard */ +-#define I2C_SMBUS_I2C_BLOCK_MAX 32 /* Not specified but we use same structure */ + union i2c_smbus_data { + __u8 byte; + __u16 word; diff --git a/i2c/i2c-13.patch b/i2c/i2c-13.patch new file mode 100644 index 0000000000000..08646042f531b --- /dev/null +++ b/i2c/i2c-13.patch @@ -0,0 +1,46 @@ +From khali@linux-fr.org Fri Oct 7 15:20:36 2005 +Date: Sat, 8 Oct 2005 00:17:35 +0200 +From: Jean Delvare <khali@linux-fr.org> +To: Greg KH <greg@kroah.com> +Subject: [PATCH 13/16] i2c: Rename i2c-parport variable to avoid confusion +Message-Id: <20051008001735.3ee379da.khali@linux-fr.org> + +It's a bit confusing to name a variable the same as an unrelated +structure. The compiler doesn't complain, but it certainly makes the +code harder to understand, and could confuse grep and LXR among +others. + +Signed-off-by: Jean Delvare <khali@linux-fr.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + + +--- + drivers/i2c/busses/i2c-parport.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- gregkh-2.6.orig/drivers/i2c/busses/i2c-parport.c ++++ gregkh-2.6/drivers/i2c/busses/i2c-parport.c +@@ -232,7 +232,7 @@ static void i2c_parport_detach (struct p + } + } + +-static struct parport_driver i2c_driver = { ++static struct parport_driver i2c_parport_driver = { + .name = "i2c-parport", + .attach = i2c_parport_attach, + .detach = i2c_parport_detach, +@@ -250,12 +250,12 @@ static int __init i2c_parport_init(void) + type = 0; + } + +- return parport_register_driver(&i2c_driver); ++ return parport_register_driver(&i2c_parport_driver); + } + + static void __exit i2c_parport_exit(void) + { +- parport_unregister_driver(&i2c_driver); ++ parport_unregister_driver(&i2c_parport_driver); + } + + MODULE_AUTHOR("Jean Delvare <khali@linux-fr.org>"); diff --git a/i2c/i2c-14.patch b/i2c/i2c-14.patch new file mode 100644 index 0000000000000..a2f25d6f3d8e2 --- /dev/null +++ b/i2c/i2c-14.patch @@ -0,0 +1,54 @@ +From khali@linux-fr.org Fri Oct 7 15:20:40 2005 +Date: Sat, 8 Oct 2005 00:19:52 +0200 +From: Jean Delvare <khali@linux-fr.org> +To: Greg KH <greg@kroah.com> +Cc: Mark A. Greer <mgreer@mvista.com>, Randy Vinson <rvinson@mvista.com> +Subject: [PATCH 14/16] i2c: Drop meaningless use of I2C_DF_NOTIFY in i2c_client structures +Message-Id: <20051008001952.08a96d53.khali@linux-fr.org> + +I2C_DF_NOTIFY is an i2c_driver flag, using it as an i2c_client flag +doesn't make any sense. + +Signed-off-by: Jean Delvare <khali@linux-fr.org> +Acked-by: Mark A. Greer <mgreer@mvista.com> +Acked-by: Randy Vinson <rvinson@mvista.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + + +--- + drivers/i2c/chips/ds1374.c | 1 - + drivers/i2c/chips/m41t00.c | 1 - + drivers/i2c/chips/rtc8564.c | 2 +- + 3 files changed, 1 insertion(+), 3 deletions(-) + +--- gregkh-2.6.orig/drivers/i2c/chips/ds1374.c ++++ gregkh-2.6/drivers/i2c/chips/ds1374.c +@@ -199,7 +199,6 @@ static int ds1374_probe(struct i2c_adapt + + memset(client, 0, sizeof(struct i2c_client)); + strncpy(client->name, DS1374_DRV_NAME, I2C_NAME_SIZE); +- client->flags = I2C_DF_NOTIFY; + client->addr = addr; + client->adapter = adap; + client->driver = &ds1374_driver; +--- gregkh-2.6.orig/drivers/i2c/chips/m41t00.c ++++ gregkh-2.6/drivers/i2c/chips/m41t00.c +@@ -180,7 +180,6 @@ m41t00_probe(struct i2c_adapter *adap, i + + memset(client, 0, sizeof(struct i2c_client)); + strncpy(client->name, M41T00_DRV_NAME, I2C_NAME_SIZE); +- client->flags = I2C_DF_NOTIFY; + client->addr = addr; + client->adapter = adap; + client->driver = &m41t00_driver; +--- gregkh-2.6.orig/drivers/i2c/chips/rtc8564.c ++++ gregkh-2.6/drivers/i2c/chips/rtc8564.c +@@ -158,7 +158,7 @@ static int rtc8564_attach(struct i2c_ada + + strlcpy(new_client->name, "RTC8564", I2C_NAME_SIZE); + i2c_set_clientdata(new_client, d); +- new_client->flags = I2C_CLIENT_ALLOW_USE | I2C_DF_NOTIFY; ++ new_client->flags = I2C_CLIENT_ALLOW_USE; + new_client->addr = addr; + new_client->adapter = adap; + new_client->driver = &rtc8564_driver; diff --git a/i2c/i2c-15.patch b/i2c/i2c-15.patch new file mode 100644 index 0000000000000..8e42ff87457ac --- /dev/null +++ b/i2c/i2c-15.patch @@ -0,0 +1,170 @@ +From khali@linux-fr.org Fri Oct 7 15:25:51 2005 +Date: Sat, 8 Oct 2005 00:21:48 +0200 +From: Jean Delvare <khali@linux-fr.org> +To: Greg KH <greg@kroah.com> +Cc: Stig Telfer <stig@lizardlogic.co.uk> +Subject: [PATCH 15/16] i2c: Fix i2c-elektor on Alpha +Message-Id: <20051008002148.74087360.khali@linux-fr.org> + +From: Stig Telfer <stig@lizardlogic.co.uk> + +This patch updates the i2c-elektor driver, enabling it to compile +cleanly, load and run. The key change is that it uses the new +__iomem/iowrite8/ioread8 functions to abstract the direct or +memory-mapped variants of register access. Also, the original driver +would crash on module load on the Alpha because the PCI memory region +was not remapped into kernel memory. + +I have managed the following testing: + +* compiled and tested it on my Alpha UP2000+ system. +* compiles cleanly for x86 but I don't have the hardware to test. + +Signed-off-by: Stig Telfer <stig@lizardlogic.co.uk> +Signed-off-by: Jean Delvare <khali@linux-fr.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + + +--- + drivers/i2c/busses/i2c-elektor.c | 74 +++++++++++++++++++++++++-------------- + 1 file changed, 49 insertions(+), 25 deletions(-) + +--- gregkh-2.6.orig/drivers/i2c/busses/i2c-elektor.c ++++ gregkh-2.6/drivers/i2c/busses/i2c-elektor.c +@@ -46,6 +46,8 @@ + #define DEFAULT_BASE 0x330 + + static int base; ++static u8 __iomem *base_iomem; ++ + static int irq; + static int clock = 0x1c; + static int own = 0x55; +@@ -64,36 +66,27 @@ static spinlock_t lock; + + static void pcf_isa_setbyte(void *data, int ctl, int val) + { +- int address = ctl ? (base + 1) : base; ++ u8 __iomem *address = ctl ? (base_iomem + 1) : base_iomem; + + /* enable irq if any specified for serial operation */ + if (ctl && irq && (val & I2C_PCF_ESO)) { + val |= I2C_PCF_ENI; + } + +- pr_debug("i2c-elektor: Write 0x%X 0x%02X\n", address, val & 255); +- +- switch (mmapped) { +- case 0: /* regular I/O */ +- outb(val, address); +- break; +- case 2: /* double mapped I/O needed for UP2000 board, +- I don't know why this... */ +- writeb(val, (void *)address); +- /* fall */ +- case 1: /* memory mapped I/O */ +- writeb(val, (void *)address); +- break; +- } ++ pr_debug("i2c-elektor: Write %p 0x%02X\n", address, val); ++ iowrite8(val, address); ++#ifdef __alpha__ ++ /* API UP2000 needs some hardware fudging to make the write stick */ ++ iowrite8(val, address); ++#endif + } + + static int pcf_isa_getbyte(void *data, int ctl) + { +- int address = ctl ? (base + 1) : base; +- int val = mmapped ? readb((void *)address) : inb(address); +- +- pr_debug("i2c-elektor: Read 0x%X 0x%02X\n", address, val); ++ u8 __iomem *address = ctl ? (base_iomem + 1) : base_iomem; ++ int val = ioread8(address); + ++ pr_debug("i2c-elektor: Read %p 0x%02X\n", address, val); + return (val); + } + +@@ -155,7 +148,30 @@ static int pcf_isa_init(void) + "is in use.\n", base); + return -ENODEV; + } ++ base_iomem = ioport_map(base, 2); ++ if (!base_iomem) { ++ printk(KERN_ERR "i2c-elektor: remap of I/O region " ++ "%#x failed\n", base); ++ release_region(base, 2); ++ return -ENODEV; ++ } ++ } else { ++ if (!request_mem_region(base, 2, "i2c-elektor")) { ++ printk(KERN_ERR "i2c-elektor: requested memory region " ++ "(%#x:2) is in use\n", base); ++ return -ENODEV; ++ } ++ base_iomem = ioremap(base, 2); ++ if (base_iomem == NULL) { ++ printk(KERN_ERR "i2c-elektor: remap of memory region " ++ "%#x failed\n", base); ++ release_mem_region(base, 2); ++ return -ENODEV; ++ } + } ++ pr_debug("i2c-elektor: registers %#x remapped to %p\n", base, ++ base_iomem); ++ + if (irq > 0) { + if (request_irq(irq, pcf_isa_handler, 0, "PCF8584", NULL) < 0) { + printk(KERN_ERR "i2c-elektor: Request irq%d failed\n", irq); +@@ -200,7 +216,7 @@ static int __init i2c_pcfisa_init(void) + cy693_dev = pci_get_device(PCI_VENDOR_ID_CONTAQ, + PCI_DEVICE_ID_CONTAQ_82C693, NULL); + if (cy693_dev) { +- char config; ++ unsigned char config; + /* yeap, we've found cypress, let's check config */ + if (!pci_read_config_byte(cy693_dev, 0x47, &config)) { + +@@ -219,9 +235,7 @@ static int __init i2c_pcfisa_init(void) + if ((config & 0x7f) == 0x61) { + /* seems to be UP2000 like board */ + base = 0xe0000; +- /* I don't know why we need to +- write twice */ +- mmapped = 2; ++ mmapped = 1; + /* UP2000 drives ISA with + 8.25 MHz (PCI/4) clock + (this can be read from cypress) */ +@@ -262,8 +276,13 @@ static int __init i2c_pcfisa_init(void) + free_irq(irq, NULL); + } + +- if (!mmapped) ++ if (!mmapped) { ++ ioport_unmap(base_iomem); + release_region(base , 2); ++ } else { ++ iounmap(base_iomem); ++ release_mem_region(base, 2); ++ } + return -ENODEV; + } + +@@ -276,8 +295,13 @@ static void i2c_pcfisa_exit(void) + free_irq(irq, NULL); + } + +- if (!mmapped) ++ if (!mmapped) { ++ ioport_unmap(base_iomem); + release_region(base , 2); ++ } else { ++ iounmap(base_iomem); ++ release_mem_region(base, 2); ++ } + } + + MODULE_AUTHOR("Hans Berglund <hb@spacetec.no>"); diff --git a/i2c/i2c-16.patch b/i2c/i2c-16.patch new file mode 100644 index 0000000000000..d43ebe6b90ea3 --- /dev/null +++ b/i2c/i2c-16.patch @@ -0,0 +1,237 @@ +From khali@linux-fr.org Fri Oct 7 15:26:01 2005 +Date: Sat, 8 Oct 2005 00:23:27 +0200 +From: Jean Delvare <khali@linux-fr.org> +To: Greg KH <greg@kroah.com> +Cc: Stig Telfer <stig@lizardlogic.co.uk> +Subject: [PATCH 16/16] i2c: Big i2c-elektor cleanup +Message-Id: <20051008002327.7f886b32.khali@linux-fr.org> + +From: Stig Telfer <stig@lizardlogic.co.uk> + +Cleanups to the i2c-elektor driver: + +* Set the i2c_adapter name field to "i2c-elektor" and use this string + in all resource requests and printks. +* Change space-padding for tab indentation, kill trailing white space, + remove space before comma. +* Use dev_info, pr_info and pr_debug instead of printk. +* Lines chopped to 80 columns. + +Signed-off-by: Stig Telfer <stig@lizardlogic.co.uk> +Signed-off-by: Jean Delvare <khali@linux-fr.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/i2c/busses/i2c-elektor.c | 84 ++++++++++++++++++++------------------- + 1 file changed, 45 insertions(+), 39 deletions(-) + +--- gregkh-2.6.orig/drivers/i2c/busses/i2c-elektor.c ++++ gregkh-2.6/drivers/i2c/busses/i2c-elektor.c +@@ -22,7 +22,7 @@ + /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even + Frodo Looijaard <frodol@dds.nl> */ + +-/* Partialy rewriten by Oleg I. Vdovikin for mmapped support of ++/* Partialy rewriten by Oleg I. Vdovikin for mmapped support of + for Alpha Processor Inc. UP-2000(+) boards */ + + #include <linux/kernel.h> +@@ -53,7 +53,7 @@ static int clock = 0x1c; + static int own = 0x55; + static int mmapped; + +-/* vdovikin: removed static struct i2c_pcf_isa gpi; code - ++/* vdovikin: removed static struct i2c_pcf_isa gpi; code - + this module in real supports only one device, due to missing arguments + in some functions, called from the algo-pcf module. Sometimes it's + need to be rewriten - but for now just remove this for simpler reading */ +@@ -62,6 +62,8 @@ static wait_queue_head_t pcf_wait; + static int pcf_pending; + static spinlock_t lock; + ++static struct i2c_adapter pcf_isa_ops; ++ + /* ----- local functions ---------------------------------------------- */ + + static void pcf_isa_setbyte(void *data, int ctl, int val) +@@ -73,7 +75,7 @@ static void pcf_isa_setbyte(void *data, + val |= I2C_PCF_ENI; + } + +- pr_debug("i2c-elektor: Write %p 0x%02X\n", address, val); ++ pr_debug("%s: Write %p 0x%02X\n", pcf_isa_ops.name, address, val); + iowrite8(val, address); + #ifdef __alpha__ + /* API UP2000 needs some hardware fudging to make the write stick */ +@@ -86,7 +88,7 @@ static int pcf_isa_getbyte(void *data, i + u8 __iomem *address = ctl ? (base_iomem + 1) : base_iomem; + int val = ioread8(address); + +- pr_debug("i2c-elektor: Read %p 0x%02X\n", address, val); ++ pr_debug("%s: Read %p 0x%02X\n", pcf_isa_ops.name, address, val); + return (val); + } + +@@ -142,39 +144,40 @@ static int pcf_isa_init(void) + { + spin_lock_init(&lock); + if (!mmapped) { +- if (!request_region(base, 2, "i2c (isa bus adapter)")) { +- printk(KERN_ERR +- "i2c-elektor: requested I/O region (0x%X:2) " +- "is in use.\n", base); ++ if (!request_region(base, 2, pcf_isa_ops.name)) { ++ printk(KERN_ERR "%s: requested I/O region (%#x:2) is " ++ "in use\n", pcf_isa_ops.name, base); + return -ENODEV; + } + base_iomem = ioport_map(base, 2); + if (!base_iomem) { +- printk(KERN_ERR "i2c-elektor: remap of I/O region " +- "%#x failed\n", base); ++ printk(KERN_ERR "%s: remap of I/O region %#x failed\n", ++ pcf_isa_ops.name, base); + release_region(base, 2); + return -ENODEV; + } + } else { +- if (!request_mem_region(base, 2, "i2c-elektor")) { +- printk(KERN_ERR "i2c-elektor: requested memory region " +- "(%#x:2) is in use\n", base); ++ if (!request_mem_region(base, 2, pcf_isa_ops.name)) { ++ printk(KERN_ERR "%s: requested memory region (%#x:2) " ++ "is in use\n", pcf_isa_ops.name, base); + return -ENODEV; + } + base_iomem = ioremap(base, 2); + if (base_iomem == NULL) { +- printk(KERN_ERR "i2c-elektor: remap of memory region " +- "%#x failed\n", base); ++ printk(KERN_ERR "%s: remap of memory region %#x " ++ "failed\n", pcf_isa_ops.name, base); + release_mem_region(base, 2); + return -ENODEV; + } + } +- pr_debug("i2c-elektor: registers %#x remapped to %p\n", base, ++ pr_debug("%s: registers %#x remapped to %p\n", pcf_isa_ops.name, base, + base_iomem); + + if (irq > 0) { +- if (request_irq(irq, pcf_isa_handler, 0, "PCF8584", NULL) < 0) { +- printk(KERN_ERR "i2c-elektor: Request irq%d failed\n", irq); ++ if (request_irq(irq, pcf_isa_handler, 0, pcf_isa_ops.name, ++ NULL) < 0) { ++ printk(KERN_ERR "%s: Request irq%d failed\n", ++ pcf_isa_ops.name, irq); + irq = 0; + } else + enable_irq(irq); +@@ -202,45 +205,49 @@ static struct i2c_adapter pcf_isa_ops = + .class = I2C_CLASS_HWMON, + .id = I2C_HW_P_ELEK, + .algo_data = &pcf_isa_data, +- .name = "PCF8584 ISA adapter", ++ .name = "i2c-elektor", + }; + +-static int __init i2c_pcfisa_init(void) ++static int __init i2c_pcfisa_init(void) + { + #ifdef __alpha__ +- /* check to see we have memory mapped PCF8584 connected to the ++ /* check to see we have memory mapped PCF8584 connected to the + Cypress cy82c693 PCI-ISA bridge as on UP2000 board */ + if (base == 0) { + struct pci_dev *cy693_dev; +- +- cy693_dev = pci_get_device(PCI_VENDOR_ID_CONTAQ, ++ ++ cy693_dev = pci_get_device(PCI_VENDOR_ID_CONTAQ, + PCI_DEVICE_ID_CONTAQ_82C693, NULL); + if (cy693_dev) { + unsigned char config; + /* yeap, we've found cypress, let's check config */ + if (!pci_read_config_byte(cy693_dev, 0x47, &config)) { +- +- pr_debug("i2c-elektor: found cy82c693, config register 0x47 = 0x%02x.\n", config); ++ ++ pr_debug("%s: found cy82c693, config " ++ "register 0x47 = 0x%02x\n", ++ pcf_isa_ops.name, config); + + /* UP2000 board has this register set to 0xe1, +- but the most significant bit as seems can be ++ but the most significant bit as seems can be + reset during the proper initialisation +- sequence if guys from API decides to do that +- (so, we can even enable Tsunami Pchip +- window for the upper 1 Gb) */ ++ sequence if guys from API decides to do that ++ (so, we can even enable Tsunami Pchip ++ window for the upper 1 Gb) */ + + /* so just check for ROMCS at 0xe0000, +- ROMCS enabled for writes ++ ROMCS enabled for writes + and external XD Bus buffer in use. */ + if ((config & 0x7f) == 0x61) { + /* seems to be UP2000 like board */ + base = 0xe0000; + mmapped = 1; +- /* UP2000 drives ISA with ++ /* UP2000 drives ISA with + 8.25 MHz (PCI/4) clock + (this can be read from cypress) */ + clock = I2C_PCF_CLK | I2C_PCF_TRNS90; +- printk(KERN_INFO "i2c-elektor: found API UP2000 like board, will probe PCF8584 later.\n"); ++ pr_info("%s: found API UP2000 like " ++ "board, will probe PCF8584 " ++ "later\n", pcf_isa_ops.name); + } + } + pci_dev_put(cy693_dev); +@@ -250,12 +257,11 @@ static int __init i2c_pcfisa_init(void) + + /* sanity checks for mmapped I/O */ + if (mmapped && base < 0xc8000) { +- printk(KERN_ERR "i2c-elektor: incorrect base address (0x%0X) specified for mmapped I/O.\n", base); ++ printk(KERN_ERR "%s: incorrect base address (%#x) specified " ++ "for mmapped I/O\n", pcf_isa_ops.name, base); + return -ENODEV; + } + +- printk(KERN_INFO "i2c-elektor: i2c pcf8584-isa adapter driver\n"); +- + if (base == 0) { + base = DEFAULT_BASE; + } +@@ -265,8 +271,8 @@ static int __init i2c_pcfisa_init(void) + return -ENODEV; + if (i2c_pcf_add_bus(&pcf_isa_ops) < 0) + goto fail; +- +- printk(KERN_ERR "i2c-elektor: found device at %#x.\n", base); ++ ++ dev_info(&pcf_isa_ops.dev, "found device at %#x\n", base); + + return 0; + +@@ -278,7 +284,7 @@ static int __init i2c_pcfisa_init(void) + + if (!mmapped) { + ioport_unmap(base_iomem); +- release_region(base , 2); ++ release_region(base, 2); + } else { + iounmap(base_iomem); + release_mem_region(base, 2); +@@ -297,7 +303,7 @@ static void i2c_pcfisa_exit(void) + + if (!mmapped) { + ioport_unmap(base_iomem); +- release_region(base , 2); ++ release_region(base, 2); + } else { + iounmap(base_iomem); + release_mem_region(base, 2); |