Commit d2a2fc18 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging

Pull i2c updates from Jean Delvare.

Fix up trivial conflict in drivers/i2c/busses/i2c-gpio.c due to include
file cleanup clashing with DT support addition (which did the same
cleanup)

* 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging:
  i2c-algo-bit: Don't resched on clock stretching
  i2c: Update the FSF address
  i2c: Convert drivers/i2c/muxes/* to use module_i2c_driver()
  i2c-i801: Use usleep_range to wait for command completion
  i2c-i801: Add device IDs for Intel Lynx Point
  i2c-isch: Decrease delay in command completion check loop
  i2c-gpio: Use linux/gpio.h rather than asm/gpio.h
parents 7bf97e1d 41101a33
...@@ -20,6 +20,7 @@ Supported adapters: ...@@ -20,6 +20,7 @@ Supported adapters:
* Intel Patsburg (PCH) * Intel Patsburg (PCH)
* Intel DH89xxCC (PCH) * Intel DH89xxCC (PCH)
* Intel Panther Point (PCH) * Intel Panther Point (PCH)
* Intel Lynx Point (PCH)
Datasheets: Publicly available at the Intel website Datasheets: Publicly available at the Intel website
On Intel Patsburg and later chipsets, both the normal host SMBus controller On Intel Patsburg and later chipsets, both the normal host SMBus controller
......
...@@ -15,7 +15,8 @@ ...@@ -15,7 +15,8 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301 USA.
* ------------------------------------------------------------------------- */ * ------------------------------------------------------------------------- */
/* With some changes from Frodo Looijaard <frodol@dds.nl>, Kyösti Mälkki /* With some changes from Frodo Looijaard <frodol@dds.nl>, Kyösti Mälkki
...@@ -111,7 +112,7 @@ static int sclhi(struct i2c_algo_bit_data *adap) ...@@ -111,7 +112,7 @@ static int sclhi(struct i2c_algo_bit_data *adap)
break; break;
return -ETIMEDOUT; return -ETIMEDOUT;
} }
cond_resched(); cpu_relax();
} }
#ifdef DEBUG #ifdef DEBUG
if (jiffies != start && i2c_debug >= 3) if (jiffies != start && i2c_debug >= 3)
......
...@@ -15,7 +15,8 @@ ...@@ -15,7 +15,8 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA.
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
......
...@@ -16,7 +16,8 @@ ...@@ -16,7 +16,8 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA.
* *
* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and * With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and
* Frodo Looijaard <frodol@dds.nl>, and also from Martin Bailey * Frodo Looijaard <frodol@dds.nl>, and also from Martin Bailey
......
...@@ -16,7 +16,8 @@ ...@@ -16,7 +16,8 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301 USA. */
/* -------------------------------------------------------------------- */ /* -------------------------------------------------------------------- */
/* With some changes from Frodo Looijaard <frodol@dds.nl> */ /* With some changes from Frodo Looijaard <frodol@dds.nl> */
......
...@@ -103,6 +103,7 @@ config I2C_I801 ...@@ -103,6 +103,7 @@ config I2C_I801
Patsburg (PCH) Patsburg (PCH)
DH89xxCC (PCH) DH89xxCC (PCH)
Panther Point (PCH) Panther Point (PCH)
Lynx Point (PCH)
This driver can also be built as a module. If so, the module This driver can also be built as a module. If so, the module
will be called i2c-i801. will be called i2c-i801.
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
Copyright (c) 1998 - 2002 Frodo Looijaard <frodol@dds.nl>, Copyright (c) 1998 - 2002 Frodo Looijaard <frodol@dds.nl>,
Philip Edelbrock <phil@netroedge.com>, and Mark D. Studebaker Philip Edelbrock <phil@netroedge.com>, and Mark D. Studebaker
<mdsxyz123@yahoo.com> <mdsxyz123@yahoo.com>
Copyright (C) 2007, 2008 Jean Delvare <khali@linux-fr.org> Copyright (C) 2007 - 2012 Jean Delvare <khali@linux-fr.org>
Copyright (C) 2010 Intel Corporation, Copyright (C) 2010 Intel Corporation,
David Woodhouse <dwmw2@infradead.org> David Woodhouse <dwmw2@infradead.org>
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
Patsburg (PCH) IDF 0x1d72 32 hard yes yes yes Patsburg (PCH) IDF 0x1d72 32 hard yes yes yes
DH89xxCC (PCH) 0x2330 32 hard yes yes yes DH89xxCC (PCH) 0x2330 32 hard yes yes yes
Panther Point (PCH) 0x1e22 32 hard yes yes yes Panther Point (PCH) 0x1e22 32 hard yes yes yes
Lynx Point (PCH) 0x8c22 32 hard yes yes yes
Features supported by this driver: Features supported by this driver:
Software PEC no Software PEC no
...@@ -105,7 +106,7 @@ ...@@ -105,7 +106,7 @@
#define SMBHSTCNT_KILL 2 #define SMBHSTCNT_KILL 2
/* Other settings */ /* Other settings */
#define MAX_TIMEOUT 100 #define MAX_RETRIES 400
#define ENABLE_INT9 0 /* set to 0x01 to enable - untested */ #define ENABLE_INT9 0 /* set to 0x01 to enable - untested */
/* I801 command constants */ /* I801 command constants */
...@@ -145,6 +146,7 @@ ...@@ -145,6 +146,7 @@
#define PCI_DEVICE_ID_INTEL_PANTHERPOINT_SMBUS 0x1e22 #define PCI_DEVICE_ID_INTEL_PANTHERPOINT_SMBUS 0x1e22
#define PCI_DEVICE_ID_INTEL_DH89XXCC_SMBUS 0x2330 #define PCI_DEVICE_ID_INTEL_DH89XXCC_SMBUS 0x2330
#define PCI_DEVICE_ID_INTEL_5_3400_SERIES_SMBUS 0x3b30 #define PCI_DEVICE_ID_INTEL_5_3400_SERIES_SMBUS 0x3b30
#define PCI_DEVICE_ID_INTEL_LYNXPOINT_SMBUS 0x8c22
struct i801_priv { struct i801_priv {
struct i2c_adapter adapter; struct i2c_adapter adapter;
...@@ -215,7 +217,7 @@ static int i801_check_post(struct i801_priv *priv, int status, int timeout) ...@@ -215,7 +217,7 @@ static int i801_check_post(struct i801_priv *priv, int status, int timeout)
dev_dbg(&priv->pci_dev->dev, "Terminating the current operation\n"); dev_dbg(&priv->pci_dev->dev, "Terminating the current operation\n");
outb_p(inb_p(SMBHSTCNT(priv)) | SMBHSTCNT_KILL, outb_p(inb_p(SMBHSTCNT(priv)) | SMBHSTCNT_KILL,
SMBHSTCNT(priv)); SMBHSTCNT(priv));
msleep(1); usleep_range(1000, 2000);
outb_p(inb_p(SMBHSTCNT(priv)) & (~SMBHSTCNT_KILL), outb_p(inb_p(SMBHSTCNT(priv)) & (~SMBHSTCNT_KILL),
SMBHSTCNT(priv)); SMBHSTCNT(priv));
...@@ -272,11 +274,11 @@ static int i801_transaction(struct i801_priv *priv, int xact) ...@@ -272,11 +274,11 @@ static int i801_transaction(struct i801_priv *priv, int xact)
/* We will always wait for a fraction of a second! */ /* We will always wait for a fraction of a second! */
do { do {
msleep(1); usleep_range(250, 500);
status = inb_p(SMBHSTSTS(priv)); status = inb_p(SMBHSTSTS(priv));
} while ((status & SMBHSTSTS_HOST_BUSY) && (timeout++ < MAX_TIMEOUT)); } while ((status & SMBHSTSTS_HOST_BUSY) && (timeout++ < MAX_RETRIES));
result = i801_check_post(priv, status, timeout > MAX_TIMEOUT); result = i801_check_post(priv, status, timeout > MAX_RETRIES);
if (result < 0) if (result < 0)
return result; return result;
...@@ -291,12 +293,12 @@ static void i801_wait_hwpec(struct i801_priv *priv) ...@@ -291,12 +293,12 @@ static void i801_wait_hwpec(struct i801_priv *priv)
int status; int status;
do { do {
msleep(1); usleep_range(250, 500);
status = inb_p(SMBHSTSTS(priv)); status = inb_p(SMBHSTSTS(priv));
} while ((!(status & SMBHSTSTS_INTR)) } while ((!(status & SMBHSTSTS_INTR))
&& (timeout++ < MAX_TIMEOUT)); && (timeout++ < MAX_RETRIES));
if (timeout > MAX_TIMEOUT) if (timeout > MAX_RETRIES)
dev_dbg(&priv->pci_dev->dev, "PEC Timeout!\n"); dev_dbg(&priv->pci_dev->dev, "PEC Timeout!\n");
outb_p(status, SMBHSTSTS(priv)); outb_p(status, SMBHSTSTS(priv));
...@@ -380,12 +382,12 @@ static int i801_block_transaction_byte_by_byte(struct i801_priv *priv, ...@@ -380,12 +382,12 @@ static int i801_block_transaction_byte_by_byte(struct i801_priv *priv,
/* We will always wait for a fraction of a second! */ /* We will always wait for a fraction of a second! */
timeout = 0; timeout = 0;
do { do {
msleep(1); usleep_range(250, 500);
status = inb_p(SMBHSTSTS(priv)); status = inb_p(SMBHSTSTS(priv));
} while ((!(status & SMBHSTSTS_BYTE_DONE)) } while ((!(status & SMBHSTSTS_BYTE_DONE))
&& (timeout++ < MAX_TIMEOUT)); && (timeout++ < MAX_RETRIES));
result = i801_check_post(priv, status, timeout > MAX_TIMEOUT); result = i801_check_post(priv, status, timeout > MAX_RETRIES);
if (result < 0) if (result < 0)
return result; return result;
...@@ -633,6 +635,7 @@ static DEFINE_PCI_DEVICE_TABLE(i801_ids) = { ...@@ -633,6 +635,7 @@ static DEFINE_PCI_DEVICE_TABLE(i801_ids) = {
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS_IDF2) }, { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS_IDF2) },
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_DH89XXCC_SMBUS) }, { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_DH89XXCC_SMBUS) },
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PANTHERPOINT_SMBUS) }, { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PANTHERPOINT_SMBUS) },
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_LYNXPOINT_SMBUS) },
{ 0, } { 0, }
}; };
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
#define SMBBLKDAT (0x20 + sch_smba) #define SMBBLKDAT (0x20 + sch_smba)
/* Other settings */ /* Other settings */
#define MAX_TIMEOUT 500 #define MAX_RETRIES 5000
/* I2C constants */ /* I2C constants */
#define SCH_QUICK 0x00 #define SCH_QUICK 0x00
...@@ -68,7 +68,7 @@ static int sch_transaction(void) ...@@ -68,7 +68,7 @@ static int sch_transaction(void)
{ {
int temp; int temp;
int result = 0; int result = 0;
int timeout = 0; int retries = 0;
dev_dbg(&sch_adapter.dev, "Transaction (pre): CNT=%02x, CMD=%02x, " dev_dbg(&sch_adapter.dev, "Transaction (pre): CNT=%02x, CMD=%02x, "
"ADD=%02x, DAT0=%02x, DAT1=%02x\n", inb(SMBHSTCNT), "ADD=%02x, DAT0=%02x, DAT1=%02x\n", inb(SMBHSTCNT),
...@@ -100,12 +100,12 @@ static int sch_transaction(void) ...@@ -100,12 +100,12 @@ static int sch_transaction(void)
outb(inb(SMBHSTCNT) | 0x10, SMBHSTCNT); outb(inb(SMBHSTCNT) | 0x10, SMBHSTCNT);
do { do {
msleep(1); usleep_range(100, 200);
temp = inb(SMBHSTSTS) & 0x0f; temp = inb(SMBHSTSTS) & 0x0f;
} while ((temp & 0x08) && (timeout++ < MAX_TIMEOUT)); } while ((temp & 0x08) && (retries++ < MAX_RETRIES));
/* If the SMBus is still busy, we give up */ /* If the SMBus is still busy, we give up */
if (timeout > MAX_TIMEOUT) { if (retries > MAX_RETRIES) {
dev_err(&sch_adapter.dev, "SMBus Timeout!\n"); dev_err(&sch_adapter.dev, "SMBus Timeout!\n");
result = -ETIMEDOUT; result = -ETIMEDOUT;
} }
......
...@@ -13,7 +13,8 @@ ...@@ -13,7 +13,8 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA.
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
......
...@@ -14,7 +14,8 @@ ...@@ -14,7 +14,8 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301 USA. */
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi>. /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi>.
......
...@@ -13,7 +13,8 @@ ...@@ -13,7 +13,8 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA.
*/ */
#include <linux/rwsem.h> #include <linux/rwsem.h>
......
...@@ -17,7 +17,8 @@ ...@@ -17,7 +17,8 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301 USA.
*/ */
/* Note that this is a complete rewrite of Simon Vogl's i2c-dev module. /* Note that this is a complete rewrite of Simon Vogl's i2c-dev module.
......
...@@ -16,7 +16,8 @@ ...@@ -16,7 +16,8 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA.
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
......
...@@ -393,18 +393,7 @@ static struct i2c_driver pca9541_driver = { ...@@ -393,18 +393,7 @@ static struct i2c_driver pca9541_driver = {
.id_table = pca9541_id, .id_table = pca9541_id,
}; };
static int __init pca9541_init(void) module_i2c_driver(pca9541_driver);
{
return i2c_add_driver(&pca9541_driver);
}
static void __exit pca9541_exit(void)
{
i2c_del_driver(&pca9541_driver);
}
module_init(pca9541_init);
module_exit(pca9541_exit);
MODULE_AUTHOR("Guenter Roeck <guenter.roeck@ericsson.com>"); MODULE_AUTHOR("Guenter Roeck <guenter.roeck@ericsson.com>");
MODULE_DESCRIPTION("PCA9541 I2C master selector driver"); MODULE_DESCRIPTION("PCA9541 I2C master selector driver");
......
...@@ -284,18 +284,7 @@ static struct i2c_driver pca954x_driver = { ...@@ -284,18 +284,7 @@ static struct i2c_driver pca954x_driver = {
.id_table = pca954x_id, .id_table = pca954x_id,
}; };
static int __init pca954x_init(void) module_i2c_driver(pca954x_driver);
{
return i2c_add_driver(&pca954x_driver);
}
static void __exit pca954x_exit(void)
{
i2c_del_driver(&pca954x_driver);
}
module_init(pca954x_init);
module_exit(pca954x_exit);
MODULE_AUTHOR("Rodolfo Giometti <giometti@linux.it>"); MODULE_AUTHOR("Rodolfo Giometti <giometti@linux.it>");
MODULE_DESCRIPTION("PCA954x I2C mux/switch driver"); MODULE_DESCRIPTION("PCA954x I2C mux/switch driver");
......
...@@ -15,7 +15,8 @@ ...@@ -15,7 +15,8 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301 USA. */
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even
......
...@@ -16,7 +16,8 @@ ...@@ -16,7 +16,8 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301 USA. */
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even
......
...@@ -16,7 +16,8 @@ ...@@ -16,7 +16,8 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301 USA.
*/ */
#ifndef _LINUX_I2C_DEV_H #ifndef _LINUX_I2C_DEV_H
......
...@@ -18,7 +18,8 @@ ...@@ -18,7 +18,8 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA.
*/ */
#ifndef _LINUX_I2C_MUX_H #ifndef _LINUX_I2C_MUX_H
......
...@@ -15,7 +15,8 @@ ...@@ -15,7 +15,8 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA.
*/ */
#ifndef _LINUX_I2C_SMBUS_H #ifndef _LINUX_I2C_SMBUS_H
......
...@@ -17,7 +17,8 @@ ...@@ -17,7 +17,8 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301 USA. */
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment