Commit 659dba34 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'i2c-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6

* 'i2c-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6:
  i2c: Fix OMAP clock prescaler to match the comment
  i2c: Refactor a kfree in i2c-dev
  i2c: Fix return value check in i2c-dev
  i2c: Enable PEC on more i2c-i801 devices
  i2c: Discard the i2c algo del_bus wrappers
  i2c: New ARM Versatile/Realview bus driver
  i2c: fix broken ds1337 initialization
  i2c: i2c-i801 documentation update
  i2c: Use the __ATTR macro where possible
  i2c: Whitespace cleanups
  i2c: Use put_user instead of copy_to_user where possible
  i2c: New Atmel AT91 bus driver
  i2c: Add support for nested i2c bus locking
  i2c: Cleanups to the i2c-nforce2 bus driver
  i2c: Add request/release_mem_region to i2c-ibm_iic bus driver
  i2c: New Philips PNX bus driver
  i2c: Delete the broken i2c-ite bus driver
  i2c: Update the list of driver IDs
  i2c: Fix documentation typos
parents 3640543d d7aef138
...@@ -216,17 +216,6 @@ Who: Thomas Gleixner <tglx@linutronix.de> ...@@ -216,17 +216,6 @@ Who: Thomas Gleixner <tglx@linutronix.de>
--------------------------- ---------------------------
What: i2c-ite and i2c-algo-ite drivers
When: September 2006
Why: These drivers never compiled since they were added to the kernel
tree 5 years ago. This feature removal can be reevaluated if
someone shows interest in the drivers, fixes them and takes over
maintenance.
http://marc.theaimsgroup.com/?l=linux-mips&m=115040510817448
Who: Jean Delvare <khali@linux-fr.org>
---------------------------
What: Bridge netfilter deferred IPv4/IPv6 output hook calling What: Bridge netfilter deferred IPv4/IPv6 output hook calling
When: January 2007 When: January 2007
Why: The deferred output hooks are a layering violation causing unusual Why: The deferred output hooks are a layering violation causing unusual
......
...@@ -5,7 +5,7 @@ Supported adapters: ...@@ -5,7 +5,7 @@ Supported adapters:
Datasheets: Datasheets:
AMD datasheet not yet available, but almost everything can be found AMD datasheet not yet available, but almost everything can be found
in publically available ACPI 2.0 specification, which the adapter in the publicly available ACPI 2.0 specification, which the adapter
follows. follows.
Author: Vojtech Pavlik <vojtech@suse.cz> Author: Vojtech Pavlik <vojtech@suse.cz>
......
...@@ -9,7 +9,10 @@ Supported adapters: ...@@ -9,7 +9,10 @@ Supported adapters:
* Intel 82801EB/ER (ICH5) (HW PEC supported, 32 byte buffer not supported) * Intel 82801EB/ER (ICH5) (HW PEC supported, 32 byte buffer not supported)
* Intel 6300ESB * Intel 6300ESB
* Intel 82801FB/FR/FW/FRW (ICH6) * Intel 82801FB/FR/FW/FRW (ICH6)
* Intel ICH7 * Intel 82801G (ICH7)
* Intel 631xESB/632xESB (ESB2)
* Intel 82801H (ICH8)
* Intel ICH9
Datasheets: Publicly available at the Intel website Datasheets: Publicly available at the Intel website
Authors: Authors:
......
...@@ -10,11 +10,11 @@ Supported adapters: ...@@ -10,11 +10,11 @@ Supported adapters:
* nForce4 MCP51 10de:0264 * nForce4 MCP51 10de:0264
* nForce4 MCP55 10de:0368 * nForce4 MCP55 10de:0368
Datasheet: not publically available, but seems to be similar to the Datasheet: not publicly available, but seems to be similar to the
AMD-8111 SMBus 2.0 adapter. AMD-8111 SMBus 2.0 adapter.
Authors: Authors:
Hans-Frieder Vogt <hfvogt@arcor.de>, Hans-Frieder Vogt <hfvogt@gmx.net>,
Thomas Leibold <thomas@plx.com>, Thomas Leibold <thomas@plx.com>,
Patrick Dreker <patrick@dreker.de> Patrick Dreker <patrick@dreker.de>
...@@ -38,7 +38,7 @@ Notes ...@@ -38,7 +38,7 @@ Notes
----- -----
The SMBus adapter in the nForce2 chipset seems to be very similar to the The SMBus adapter in the nForce2 chipset seems to be very similar to the
SMBus 2.0 adapter in the AMD-8111 southbridge. However, I could only get SMBus 2.0 adapter in the AMD-8111 south bridge. However, I could only get
the driver to work with direct I/O access, which is different to the EC the driver to work with direct I/O access, which is different to the EC
interface of the AMD-8111. Tested on Asus A7N8X. The ACPI DSDT table of the interface of the AMD-8111. Tested on Asus A7N8X. The ACPI DSDT table of the
Asus A7N8X lists two SMBuses, both of which are supported by this driver. Asus A7N8X lists two SMBuses, both of which are supported by this driver.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Makefile for the linux kernel. # Makefile for the linux kernel.
# #
obj-y := core.o irq.o time.o clock.o gpio.o serial.o dma.o obj-y := core.o irq.o time.o clock.o gpio.o serial.o dma.o i2c.o
obj-m := obj-m :=
obj-n := obj-n :=
obj- := obj- :=
......
/*
* I2C initialization for PNX4008.
*
* Author: Vitaly Wool <vitalywool@gmail.com>
*
* 2005-2006 (c) MontaVista Software, Inc. This file is licensed under
* the terms of the GNU General Public License version 2. This program
* is licensed "as is" without any warranty of any kind, whether express
* or implied.
*/
#include <linux/clk.h>
#include <linux/i2c.h>
#include <linux/i2c-pnx.h>
#include <linux/platform_device.h>
#include <linux/err.h>
#include <asm/arch/platform.h>
#include <asm/arch/i2c.h>
static int set_clock_run(struct platform_device *pdev)
{
struct clk *clk;
char name[10];
int retval = 0;
snprintf(name, 10, "i2c%d_ck", pdev->id);
clk = clk_get(&pdev->dev, name);
if (!IS_ERR(clk)) {
clk_set_rate(clk, 1);
clk_put(clk);
} else
retval = -ENOENT;
return retval;
}
static int set_clock_stop(struct platform_device *pdev)
{
struct clk *clk;
char name[10];
int retval = 0;
snprintf(name, 10, "i2c%d_ck", pdev->id);
clk = clk_get(&pdev->dev, name);
if (!IS_ERR(clk)) {
clk_set_rate(clk, 0);
clk_put(clk);
} else
retval = -ENOENT;
return retval;
}
static int i2c_pnx_suspend(struct platform_device *pdev, pm_message_t state)
{
int retval = 0;
#ifdef CONFIG_PM
retval = set_clock_run(pdev);
#endif
return retval;
}
static int i2c_pnx_resume(struct platform_device *pdev)
{
int retval = 0;
#ifdef CONFIG_PM
retval = set_clock_run(pdev);
#endif
return retval;
}
static u32 calculate_input_freq(struct platform_device *pdev)
{
return HCLK_MHZ;
}
static struct i2c_pnx_algo_data pnx_algo_data0 = {
.base = PNX4008_I2C1_BASE,
.irq = I2C_1_INT,
};
static struct i2c_pnx_algo_data pnx_algo_data1 = {
.base = PNX4008_I2C2_BASE,
.irq = I2C_2_INT,
};
static struct i2c_pnx_algo_data pnx_algo_data2 = {
.base = (PNX4008_USB_CONFIG_BASE + 0x300),
.irq = USB_I2C_INT,
};
static struct i2c_adapter pnx_adapter0 = {
.name = I2C_CHIP_NAME "0",
.algo_data = &pnx_algo_data0,
};
static struct i2c_adapter pnx_adapter1 = {
.name = I2C_CHIP_NAME "1",
.algo_data = &pnx_algo_data1,
};
static struct i2c_adapter pnx_adapter2 = {
.name = "USB-I2C",
.algo_data = &pnx_algo_data2,
};
static struct i2c_pnx_data i2c0_data = {
.suspend = i2c_pnx_suspend,
.resume = i2c_pnx_resume,
.calculate_input_freq = calculate_input_freq,
.set_clock_run = set_clock_run,
.set_clock_stop = set_clock_stop,
.adapter = &pnx_adapter0,
};
static struct i2c_pnx_data i2c1_data = {
.suspend = i2c_pnx_suspend,
.resume = i2c_pnx_resume,
.calculate_input_freq = calculate_input_freq,
.set_clock_run = set_clock_run,
.set_clock_stop = set_clock_stop,
.adapter = &pnx_adapter1,
};
static struct i2c_pnx_data i2c2_data = {
.suspend = i2c_pnx_suspend,
.resume = i2c_pnx_resume,
.calculate_input_freq = calculate_input_freq,
.set_clock_run = set_clock_run,
.set_clock_stop = set_clock_stop,
.adapter = &pnx_adapter2,
};
static struct platform_device i2c0_device = {
.name = "pnx-i2c",
.id = 0,
.dev = {
.platform_data = &i2c0_data,
},
};
static struct platform_device i2c1_device = {
.name = "pnx-i2c",
.id = 1,
.dev = {
.platform_data = &i2c1_data,
},
};
static struct platform_device i2c2_device = {
.name = "pnx-i2c",
.id = 2,
.dev = {
.platform_data = &i2c2_data,
},
};
static struct platform_device *devices[] __initdata = {
&i2c0_device,
&i2c1_device,
&i2c2_device,
};
void __init pnx4008_register_i2c_devices(void)
{
platform_add_devices(devices, ARRAY_SIZE(devices));
}
...@@ -141,6 +141,19 @@ struct platform_device realview_smc91x_device = { ...@@ -141,6 +141,19 @@ struct platform_device realview_smc91x_device = {
.resource = realview_smc91x_resources, .resource = realview_smc91x_resources,
}; };
static struct resource realview_i2c_resource = {
.start = REALVIEW_I2C_BASE,
.end = REALVIEW_I2C_BASE + SZ_4K - 1,
.flags = IORESOURCE_MEM,
};
struct platform_device realview_i2c_device = {
.name = "versatile-i2c",
.id = -1,
.num_resources = 1,
.resource = &realview_i2c_resource,
};
#define REALVIEW_SYSMCI (__io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_MCI_OFFSET) #define REALVIEW_SYSMCI (__io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_MCI_OFFSET)
static unsigned int realview_mmc_status(struct device *dev) static unsigned int realview_mmc_status(struct device *dev)
......
...@@ -108,6 +108,7 @@ static struct amba_device name##_device = { \ ...@@ -108,6 +108,7 @@ static struct amba_device name##_device = { \
extern struct platform_device realview_flash_device; extern struct platform_device realview_flash_device;
extern struct platform_device realview_smc91x_device; extern struct platform_device realview_smc91x_device;
extern struct platform_device realview_i2c_device;
extern struct mmc_platform_data realview_mmc0_plat_data; extern struct mmc_platform_data realview_mmc0_plat_data;
extern struct mmc_platform_data realview_mmc1_plat_data; extern struct mmc_platform_data realview_mmc1_plat_data;
extern struct clk realview_clcd_clk; extern struct clk realview_clcd_clk;
......
...@@ -155,6 +155,7 @@ static void __init realview_eb_init(void) ...@@ -155,6 +155,7 @@ static void __init realview_eb_init(void)
platform_device_register(&realview_flash_device); platform_device_register(&realview_flash_device);
platform_device_register(&realview_smc91x_device); platform_device_register(&realview_smc91x_device);
platform_device_register(&realview_i2c_device);
for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
struct amba_device *d = amba_devs[i]; struct amba_device *d = amba_devs[i];
......
...@@ -325,6 +325,19 @@ static struct platform_device smc91x_device = { ...@@ -325,6 +325,19 @@ static struct platform_device smc91x_device = {
.resource = smc91x_resources, .resource = smc91x_resources,
}; };
static struct resource versatile_i2c_resource = {
.start = VERSATILE_I2C_BASE,
.end = VERSATILE_I2C_BASE + SZ_4K - 1,
.flags = IORESOURCE_MEM,
};
static struct platform_device versatile_i2c_device = {
.name = "versatile-i2c",
.id = -1,
.num_resources = 1,
.resource = &versatile_i2c_resource,
};
#define VERSATILE_SYSMCI (__io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_MCI_OFFSET) #define VERSATILE_SYSMCI (__io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_MCI_OFFSET)
unsigned int mmc_status(struct device *dev) unsigned int mmc_status(struct device *dev)
...@@ -775,6 +788,7 @@ void __init versatile_init(void) ...@@ -775,6 +788,7 @@ void __init versatile_init(void)
clk_register(&versatile_clcd_clk); clk_register(&versatile_clcd_clk);
platform_device_register(&versatile_flash_device); platform_device_register(&versatile_flash_device);
platform_device_register(&versatile_i2c_device);
platform_device_register(&smc91x_device); platform_device_register(&smc91x_device);
for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
......
...@@ -360,7 +360,7 @@ static int __init i2c_ioc_init(void) ...@@ -360,7 +360,7 @@ static int __init i2c_ioc_init(void)
if (ret >= 0){ if (ret >= 0){
ret = misc_register(&rtc_dev); ret = misc_register(&rtc_dev);
if(ret < 0) if(ret < 0)
i2c_bit_del_bus(&ioc_ops); i2c_del_adapter(&ioc_ops);
} }
return ret; return ret;
......
...@@ -38,17 +38,6 @@ config I2C_ALGOPCA ...@@ -38,17 +38,6 @@ config I2C_ALGOPCA
This support is also available as a module. If so, the module This support is also available as a module. If so, the module
will be called i2c-algo-pca. will be called i2c-algo-pca.
config I2C_ALGOITE
tristate "ITE I2C Algorithm"
depends on MIPS_ITE8172 && I2C
help
This supports the use of the ITE8172 I2C interface found on some MIPS
systems. Say Y if you have one of these. You should also say Y for
the ITE I2C peripheral driver support below.
This support is also available as a module. If so, the module
will be called i2c-algo-ite.
config I2C_ALGO8XX config I2C_ALGO8XX
tristate "MPC8xx CPM I2C interface" tristate "MPC8xx CPM I2C interface"
depends on 8xx && I2C depends on 8xx && I2C
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
obj-$(CONFIG_I2C_ALGOBIT) += i2c-algo-bit.o obj-$(CONFIG_I2C_ALGOBIT) += i2c-algo-bit.o
obj-$(CONFIG_I2C_ALGOPCF) += i2c-algo-pcf.o obj-$(CONFIG_I2C_ALGOPCF) += i2c-algo-pcf.o
obj-$(CONFIG_I2C_ALGOPCA) += i2c-algo-pca.o obj-$(CONFIG_I2C_ALGOPCA) += i2c-algo-pca.o
obj-$(CONFIG_I2C_ALGOITE) += i2c-algo-ite.o
obj-$(CONFIG_I2C_ALGO_SGI) += i2c-algo-sgi.o obj-$(CONFIG_I2C_ALGO_SGI) += i2c-algo-sgi.o
ifeq ($(CONFIG_I2C_DEBUG_ALGO),y) ifeq ($(CONFIG_I2C_DEBUG_ALGO),y)
......
...@@ -540,15 +540,7 @@ int i2c_bit_add_bus(struct i2c_adapter *adap) ...@@ -540,15 +540,7 @@ int i2c_bit_add_bus(struct i2c_adapter *adap)
return i2c_add_adapter(adap); return i2c_add_adapter(adap);
} }
int i2c_bit_del_bus(struct i2c_adapter *adap)
{
return i2c_del_adapter(adap);
}
EXPORT_SYMBOL(i2c_bit_add_bus); EXPORT_SYMBOL(i2c_bit_add_bus);
EXPORT_SYMBOL(i2c_bit_del_bus);
MODULE_AUTHOR("Simon G. Vogl <simon@tk.uni-linz.ac.at>"); MODULE_AUTHOR("Simon G. Vogl <simon@tk.uni-linz.ac.at>");
MODULE_DESCRIPTION("I2C-Bus bit-banging algorithm"); MODULE_DESCRIPTION("I2C-Bus bit-banging algorithm");
......
This diff is collapsed.
/*
--------------------------------------------------------------------
i2c-ite.h: Global defines for the I2C controller on board the
ITE MIPS processor.
--------------------------------------------------------------------
Hai-Pao Fan, MontaVista Software, Inc.
hpfan@mvista.com or source@mvista.com
Copyright 2001 MontaVista Software Inc.
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef I2C_ITE_H
#define I2C_ITE_H 1
#include <asm/it8172/it8172.h>
/* I2C Registers */
#define ITE_I2CHCR IT8172_PCI_IO_BASE + IT_I2C_BASE + 0x30
#define ITE_I2CHSR IT8172_PCI_IO_BASE + IT_I2C_BASE + 0x34
#define ITE_I2CSAR IT8172_PCI_IO_BASE + IT_I2C_BASE + 0x38
#define ITE_I2CSSAR IT8172_PCI_IO_BASE + IT_I2C_BASE + 0x3c
#define ITE_I2CCKCNT IT8172_PCI_IO_BASE + IT_I2C_BASE + 0x48
#define ITE_I2CSHDR IT8172_PCI_IO_BASE + IT_I2C_BASE + 0x4c
#define ITE_I2CRSUR IT8172_PCI_IO_BASE + IT_I2C_BASE + 0x50
#define ITE_I2CPSUR IT8172_PCI_IO_BASE + IT_I2C_BASE + 0x54
#define ITE_I2CFDR IT8172_PCI_IO_BASE + IT_I2C_BASE + 0x70
#define ITE_I2CFBCR IT8172_PCI_IO_BASE + IT_I2C_BASE + 0x74
#define ITE_I2CFCR IT8172_PCI_IO_BASE + IT_I2C_BASE + 0x78
#define ITE_I2CFSR IT8172_PCI_IO_BASE + IT_I2C_BASE + 0x7c
/* Host Control Register ITE_I2CHCR */
#define ITE_I2CHCR_HCE 0x01 /* Enable I2C Host Controller */
#define ITE_I2CHCR_IE 0x02 /* Enable the interrupt after completing
the current transaction */
#define ITE_I2CHCR_CP_W 0x00 /* bit2-4 000 - Write */
#define ITE_I2CHCR_CP_R 0x08 /* 010 - Current address read */
#define ITE_I2CHCR_CP_S 0x10 /* 100 - Sequential read */
#define ITE_I2CHCR_ST 0x20 /* Initiates the I2C host controller to execute
the command and send the data programmed in
all required registers to I2C bus */
#define ITE_CMD ITE_I2CHCR_HCE | ITE_I2CHCR_IE | ITE_I2CHCR_ST
#define ITE_WRITE ITE_CMD | ITE_I2CHCR_CP_W
#define ITE_READ ITE_CMD | ITE_I2CHCR_CP_R
#define ITE_SREAD ITE_CMD | ITE_I2CHCR_CP_S
/* Host Status Register ITE_I2CHSR */
#define ITE_I2CHSR_DB 0x01 /* Device is busy, receives NACK response except
in the first and last bytes */
#define ITE_I2CHSR_DNE 0x02 /* Target address on I2C bus does not exist */
#define ITE_I2CHSR_TDI 0x04 /* R/W Transaction on I2C bus was completed */
#define ITE_I2CHSR_HB 0x08 /* Host controller is processing transactions */
#define ITE_I2CHSR_FER 0x10 /* Error occurs in the FIFO */
/* Slave Address Register ITE_I2CSAR */
#define ITE_I2CSAR_SA_MASK 0xfe /* Target I2C device address */
#define ITE_I2CSAR_ASO 0x0100 /* Output 1/0 to I2CAS port when the
next slave address is addressed */
/* Slave Sub-address Register ITE_I2CSSAR */
#define ITE_I2CSSAR_SUBA_MASK 0xff /* Target I2C device sub-address */
/* Clock Counter Register ITE_I2CCKCNT */
#define ITE_I2CCKCNT_STOP 0x00 /* stop I2C clock */
#define ITE_I2CCKCNT_HPCC_MASK 0x7f /* SCL high period counter */
#define ITE_I2CCKCNT_LPCC_MASK 0x7f00 /* SCL low period counter */
/* START Hold Time Register ITE_I2CSHDR */
/* value is counted based on 16 MHz internal clock */
#define ITE_I2CSHDR_FM 0x0a /* START condition at fast mode */
#define ITE_I2CSHDR_SM 0x47 /* START contition at standard mode */
/* (Repeated) START Setup Time Register ITE_I2CRSUR */
/* value is counted based on 16 MHz internal clock */
#define ITE_I2CRSUR_FM 0x0a /* repeated START condition at fast mode */
#define ITE_I2CRSUR_SM 0x50 /* repeated START condition at standard mode */
/* STOP setup Time Register ITE_I2CPSUR */
/* FIFO Data Register ITE_I2CFDR */
#define ITE_I2CFDR_MASK 0xff
/* FIFO Byte Count Register ITE_I2CFBCR */
#define ITE_I2CFBCR_MASK 0x3f
/* FIFO Control Register ITE_I2CFCR */
#define ITE_I2CFCR_FLUSH 0x01 /* Flush FIFO and reset the FIFO point
and I2CFSR */
/* FIFO Status Register ITE_I2CFSR */
#define ITE_I2CFSR_FO 0x01 /* FIFO is overrun when write */
#define ITE_I2CFSR_FU 0x02 /* FIFO is underrun when read */
#define ITE_I2CFSR_FF 0x04 /* FIFO is full when write */
#define ITE_I2CFSR_FE 0x08 /* FIFO is empty when read */
#endif /* I2C_ITE_H */
...@@ -381,14 +381,7 @@ int i2c_pca_add_bus(struct i2c_adapter *adap) ...@@ -381,14 +381,7 @@ int i2c_pca_add_bus(struct i2c_adapter *adap)
return rval; return rval;
} }
int i2c_pca_del_bus(struct i2c_adapter *adap)
{
return i2c_del_adapter(adap);
}
EXPORT_SYMBOL(i2c_pca_add_bus); EXPORT_SYMBOL(i2c_pca_add_bus);
EXPORT_SYMBOL(i2c_pca_del_bus);
MODULE_AUTHOR("Ian Campbell <icampbell@arcom.com>"); MODULE_AUTHOR("Ian Campbell <icampbell@arcom.com>");
MODULE_DESCRIPTION("I2C-Bus PCA9564 algorithm"); MODULE_DESCRIPTION("I2C-Bus PCA9564 algorithm");
......
...@@ -486,15 +486,7 @@ int i2c_pcf_add_bus(struct i2c_adapter *adap) ...@@ -486,15 +486,7 @@ int i2c_pcf_add_bus(struct i2c_adapter *adap)
return rval; return rval;
} }
int i2c_pcf_del_bus(struct i2c_adapter *adap)
{
return i2c_del_adapter(adap);
}
EXPORT_SYMBOL(i2c_pcf_add_bus); EXPORT_SYMBOL(i2c_pcf_add_bus);
EXPORT_SYMBOL(i2c_pcf_del_bus);
MODULE_AUTHOR("Hans Berglund <hb@spacetec.no>"); MODULE_AUTHOR("Hans Berglund <hb@spacetec.no>");
MODULE_DESCRIPTION("I2C-Bus PCF8584 algorithm"); MODULE_DESCRIPTION("I2C-Bus PCF8584 algorithm");
......
...@@ -171,15 +171,7 @@ int i2c_sgi_add_bus(struct i2c_adapter *adap) ...@@ -171,15 +171,7 @@ int i2c_sgi_add_bus(struct i2c_adapter *adap)
return i2c_add_adapter(adap); return i2c_add_adapter(adap);
} }
int i2c_sgi_del_bus(struct i2c_adapter *adap)
{
return i2c_del_adapter(adap);
}
EXPORT_SYMBOL(i2c_sgi_add_bus); EXPORT_SYMBOL(i2c_sgi_add_bus);
EXPORT_SYMBOL(i2c_sgi_del_bus);
MODULE_AUTHOR("Ladislav Michl <ladis@linux-mips.org>"); MODULE_AUTHOR("Ladislav Michl <ladis@linux-mips.org>");
MODULE_DESCRIPTION("I2C-Bus SGI algorithm"); MODULE_DESCRIPTION("I2C-Bus SGI algorithm");
......
...@@ -74,6 +74,13 @@ config I2C_AMD8111 ...@@ -74,6 +74,13 @@ config I2C_AMD8111
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-amd8111. will be called i2c-amd8111.
config I2C_AT91
tristate "Atmel AT91 I2C Two-Wire interface (TWI)"
depends on I2C && ARCH_AT91 && EXPERIMENTAL
help
This supports the use of the I2C interface on Atmel AT91
processors.
config I2C_AU1550 config I2C_AU1550
tristate "Au1550/Au1200 SMBus interface" tristate "Au1550/Au1200 SMBus interface"
depends on I2C && (SOC_AU1550 || SOC_AU1200) depends on I2C && (SOC_AU1550 || SOC_AU1200)
...@@ -209,18 +216,6 @@ config I2C_ISA ...@@ -209,18 +216,6 @@ config I2C_ISA
tristate tristate
depends on I2C depends on I2C
config I2C_ITE
tristate "ITE I2C Adapter"
depends on I2C && MIPS_ITE8172
select I2C_ALGOITE
help
This supports the ITE8172 I2C peripheral found on some MIPS
systems. Say Y if you have one of these. You should also say Y for
the ITE I2C driver algorithm support above.
This support is also available as a module. If so, the module
will be called i2c-ite.
config I2C_IXP4XX config I2C_IXP4XX
tristate "IXP4xx GPIO-Based I2C Interface" tristate "IXP4xx GPIO-Based I2C Interface"
depends on I2C && ARCH_IXP4XX depends on I2C && ARCH_IXP4XX
...@@ -481,6 +476,17 @@ config I2C_STUB ...@@ -481,6 +476,17 @@ config I2C_STUB
If you don't know what to do here, definitely say N. If you don't know what to do here, definitely say N.
config I2C_VERSATILE
tristate "ARM Versatile/Realview I2C bus support"
depends on I2C && (ARCH_VERSATILE || ARCH_REALVIEW)
select I2C_ALGOBIT
help
Say yes if you want to support the I2C serial bus on ARMs Versatile
range of platforms.
This driver can also be built as a module. If so, the module
will be called i2c-versatile.
config I2C_VIA config I2C_VIA
tristate "VIA 82C586B" tristate "VIA 82C586B"
depends on I2C && PCI && EXPERIMENTAL depends on I2C && PCI && EXPERIMENTAL
...@@ -548,4 +554,23 @@ config I2C_MV64XXX ...@@ -548,4 +554,23 @@ config I2C_MV64XXX
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-mv64xxx. will be called i2c-mv64xxx.
config I2C_PNX
tristate "I2C bus support for Philips PNX targets"
depends on ARCH_PNX4008 && I2C
help
This driver supports the Philips IP3204 I2C IP block master and/or
slave controller
This driver can also be built as a module. If so, the module
will be called i2c-pnx.
config I2C_PNX_EARLY
bool "Early initialization for I2C on PNXxxxx"
depends on I2C_PNX=y
help
Under certain circumstances one may need to make sure I2C on PNXxxxx
is initialized earlier than some other driver that depends on it
(for instance, that might be USB in case of PNX4008). With this
option turned on you can guarantee that.
endmenu endmenu
...@@ -8,6 +8,7 @@ obj-$(CONFIG_I2C_ALI15X3) += i2c-ali15x3.o ...@@ -8,6 +8,7 @@ obj-$(CONFIG_I2C_ALI15X3) += i2c-ali15x3.o
obj-$(CONFIG_I2C_AMD756) += i2c-amd756.o obj-$(CONFIG_I2C_AMD756) += i2c-amd756.o
obj-$(CONFIG_I2C_AMD756_S4882) += i2c-amd756-s4882.o obj-$(CONFIG_I2C_AMD756_S4882) += i2c-amd756-s4882.o
obj-$(CONFIG_I2C_AMD8111) += i2c-amd8111.o obj-$(CONFIG_I2C_AMD8111) += i2c-amd8111.o
obj-$(CONFIG_I2C_AT91) += i2c-at91.o
obj-$(CONFIG_I2C_AU1550) += i2c-au1550.o obj-$(CONFIG_I2C_AU1550) += i2c-au1550.o
obj-$(CONFIG_I2C_ELEKTOR) += i2c-elektor.o obj-$(CONFIG_I2C_ELEKTOR) += i2c-elektor.o
obj-$(CONFIG_I2C_HYDRA) += i2c-hydra.o obj-$(CONFIG_I2C_HYDRA) += i2c-hydra.o
...@@ -16,7 +17,6 @@ obj-$(CONFIG_I2C_I810) += i2c-i810.o ...@@ -16,7 +17,6 @@ obj-$(CONFIG_I2C_I810) += i2c-i810.o
obj-$(CONFIG_I2C_IBM_IIC) += i2c-ibm_iic.o obj-$(CONFIG_I2C_IBM_IIC) += i2c-ibm_iic.o
obj-$(CONFIG_I2C_IOP3XX) += i2c-iop3xx.o obj-$(CONFIG_I2C_IOP3XX) += i2c-iop3xx.o
obj-$(CONFIG_I2C_ISA) += i2c-isa.o obj-$(CONFIG_I2C_ISA) += i2c-isa.o
obj-$(CONFIG_I2C_ITE) += i2c-ite.o
obj-$(CONFIG_I2C_IXP2000) += i2c-ixp2000.o obj-$(CONFIG_I2C_IXP2000) += i2c-ixp2000.o
obj-$(CONFIG_I2C_IXP4XX) += i2c-ixp4xx.o obj-$(CONFIG_I2C_IXP4XX) += i2c-ixp4xx.o
obj-$(CONFIG_I2C_POWERMAC) += i2c-powermac.o obj-$(CONFIG_I2C_POWERMAC) += i2c-powermac.o
...@@ -29,6 +29,7 @@ obj-$(CONFIG_I2C_PARPORT) += i2c-parport.o ...@@ -29,6 +29,7 @@ obj-$(CONFIG_I2C_PARPORT) += i2c-parport.o
obj-$(CONFIG_I2C_PARPORT_LIGHT) += i2c-parport-light.o obj-$(CONFIG_I2C_PARPORT_LIGHT) += i2c-parport-light.o
obj-$(CONFIG_I2C_PCA_ISA) += i2c-pca-isa.o obj-$(CONFIG_I2C_PCA_ISA) += i2c-pca-isa.o
obj-$(CONFIG_I2C_PIIX4) += i2c-piix4.o obj-$(CONFIG_I2C_PIIX4) += i2c-piix4.o
obj-$(CONFIG_I2C_PNX) += i2c-pnx.o
obj-$(CONFIG_I2C_PROSAVAGE) += i2c-prosavage.o obj-$(CONFIG_I2C_PROSAVAGE) += i2c-prosavage.o
obj-$(CONFIG_I2C_PXA) += i2c-pxa.o obj-$(CONFIG_I2C_PXA) += i2c-pxa.o
obj-$(CONFIG_I2C_RPXLITE) += i2c-rpx.o obj-$(CONFIG_I2C_RPXLITE) += i2c-rpx.o
...@@ -39,6 +40,7 @@ obj-$(CONFIG_I2C_SIS5595) += i2c-sis5595.o ...@@ -39,6 +40,7 @@ obj-$(CONFIG_I2C_SIS5595) += i2c-sis5595.o
obj-$(CONFIG_I2C_SIS630) += i2c-sis630.o obj-$(CONFIG_I2C_SIS630) += i2c-sis630.o
obj-$(CONFIG_I2C_SIS96X) += i2c-sis96x.o obj-$(CONFIG_I2C_SIS96X) += i2c-sis96x.o
obj-$(CONFIG_I2C_STUB) += i2c-stub.o obj-$(CONFIG_I2C_STUB) += i2c-stub.o
obj-$(CONFIG_I2C_VERSATILE) += i2c-versatile.o
obj-$(CONFIG_I2C_VIA) += i2c-via.o obj-$(CONFIG_I2C_VIA) += i2c-via.o
obj-$(CONFIG_I2C_VIAPRO) += i2c-viapro.o obj-$(CONFIG_I2C_VIAPRO) += i2c-viapro.o
obj-$(CONFIG_I2C_VOODOO3) += i2c-voodoo3.o obj-$(CONFIG_I2C_VOODOO3) += i2c-voodoo3.o
......
/*
i2c Support for Atmel's AT91 Two-Wire Interface (TWI)
Copyright (C) 2004 Rick Bronson
Converted to 2.6 by Andrew Victor <andrew@sanpeople.com>
Borrowed heavily from original work by:
Copyright (C) 2000 Philip Edelbrock <phil@stimpy.netroedge.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
*/
#include <linux/module.h>
#include <linux/version.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/pci.h>
#include <linux/types.h>
#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/init.h>
#include <linux/clk.h>
#include <linux/platform_device.h>
#include <asm/io.h>
#include <asm/arch/at91_twi.h>
#include <asm/arch/board.h>
#include <asm/arch/cpu.h>
#define TWI_CLOCK 100000 /* Hz. max 400 Kbits/sec */
static struct clk *twi_clk;
static void __iomem *twi_base;
#define at91_twi_read(reg) __raw_readl(twi_base + (reg))
#define at91_twi_write(reg, val) __raw_writel((val), twi_base + (reg))
/*
* Initialize the TWI hardware registers.
*/
static void __devinit at91_twi_hwinit(void)
{
unsigned long cdiv, ckdiv;
at91_twi_write(AT91_TWI_IDR, 0xffffffff); /* Disable all interrupts */
at91_twi_write(AT91_TWI_CR, AT91_TWI_SWRST); /* Reset peripheral */
at91_twi_write(AT91_TWI_CR, AT91_TWI_MSEN); /* Set Master mode */
/* Calcuate clock dividers */
cdiv = (clk_get_rate(twi_clk) / (2 * TWI_CLOCK)) - 3;
cdiv = cdiv + 1; /* round up */
ckdiv = 0;
while (cdiv > 255) {
ckdiv++;
cdiv = cdiv >> 1;
}
if (cpu_is_at91rm9200()) { /* AT91RM9200 Errata #22 */
if (ckdiv > 5) {
printk(KERN_ERR "AT91 I2C: Invalid TWI_CLOCK value!\n");
ckdiv = 5;
}
}
at91_twi_write(AT91_TWI_CWGR, (ckdiv << 16) | (cdiv << 8) | cdiv);
}
/*
* Poll the i2c status register until the specified bit is set.
* Returns 0 if timed out (100 msec).
*/
static short at91_poll_status(unsigned long bit)
{
int loop_cntr = 10000;
do {
udelay(10);
} while (!(at91_twi_read(AT91_TWI_SR) & bit) && (--loop_cntr > 0));
return (loop_cntr > 0);
}
static int xfer_read(struct i2c_adapter *adap, unsigned char *buf, int length)
{
/* Send Start */
at91_twi_write(AT91_TWI_CR, AT91_TWI_START);
/* Read data */
while (length--) {
if (!length) /* need to send Stop before reading last byte */
at91_twi_write(AT91_TWI_CR, AT91_TWI_STOP);
if (!at91_poll_status(AT91_TWI_RXRDY)) {
dev_dbg(&adap->dev, "RXRDY timeout\n");
return -ETIMEDOUT;
}
*buf++ = (at91_twi_read(AT91_TWI_RHR) & 0xff);
}
return 0;
}
static int xfer_write(struct i2c_adapter *adap, unsigned char *buf, int length)
{
/* Load first byte into transmitter */
at91_twi_write(AT91_TWI_THR, *buf++);
/* Send Start */
at91_twi_write(AT91_TWI_CR, AT91_TWI_START);
do {
if (!at91_poll_status(AT91_TWI_TXRDY)) {
dev_dbg(&adap->dev, "TXRDY timeout\n");
return -ETIMEDOUT;
}
length--; /* byte was transmitted */
if (length > 0) /* more data to send? */
at91_twi_write(AT91_TWI_THR, *buf++);
} while (length);
/* Send Stop */
at91_twi_write(AT91_TWI_CR, AT91_TWI_STOP);
return 0;
}
/*
* Generic i2c master transfer entrypoint.
*
* Note: We do not use Atmel's feature of storing the "internal device address".
* Instead the "internal device address" has to be written using a seperate
* i2c message.
* http://lists.arm.linux.org.uk/pipermail/linux-arm-kernel/2004-September/024411.html
*/
static int at91_xfer(struct i2c_adapter *adap, struct i2c_msg *pmsg, int num)
{
int i, ret;
dev_dbg(&adap->dev, "at91_xfer: processing %d messages:\n", num);
for (i = 0; i < num; i++) {
dev_dbg(&adap->dev, " #%d: %sing %d byte%s %s 0x%02x\n", i,
pmsg->flags & I2C_M_RD ? "read" : "writ",
pmsg->len, pmsg->len > 1 ? "s" : "",
pmsg->flags & I2C_M_RD ? "from" : "to", pmsg->addr);
at91_twi_write(AT91_TWI_MMR, (pmsg->addr << 16)
| ((pmsg->flags & I2C_M_RD) ? AT91_TWI_MREAD : 0));
if (pmsg->len && pmsg->buf) { /* sanity check */
if (pmsg->flags & I2C_M_RD)
ret = xfer_read(adap, pmsg->buf, pmsg->len);
else
ret = xfer_write(adap, pmsg->buf, pmsg->len);
if (ret)
return ret;
/* Wait until transfer is finished */
if (!at91_poll_status(AT91_TWI_TXCOMP)) {
dev_dbg(&adap->dev, "TXCOMP timeout\n");
return -ETIMEDOUT;
}
}
dev_dbg(&adap->dev, "transfer complete\n");
pmsg++; /* next message */
}
return i;
}
/*
* Return list of supported functionality.
*/
static u32 at91_func(struct i2c_adapter *adapter)
{
return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;
}
static struct i2c_algorithm at91_algorithm = {
.master_xfer = at91_xfer,
.functionality = at91_func,
};
/*
* Main initialization routine.
*/
static int __devinit at91_i2c_probe(struct platform_device *pdev)
{
struct i2c_adapter *adapter;
struct resource *res;
int rc;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res)
return -ENXIO;
if (!request_mem_region(res->start, res->end - res->start + 1, "at91_i2c"))
return -EBUSY;
twi_base = ioremap(res->start, res->end - res->start + 1);
if (!twi_base) {
rc = -ENOMEM;
goto fail0;
}
twi_clk = clk_get(NULL, "twi_clk");
if (IS_ERR(twi_clk)) {
dev_err(&pdev->dev, "no clock defined\n");
rc = -ENODEV;
goto fail1;
}
adapter = kzalloc(sizeof(struct i2c_adapter), GFP_KERNEL);
if (adapter == NULL) {
dev_err(&pdev->dev, "can't allocate inteface!\n");
rc = -ENOMEM;
goto fail2;
}
sprintf(adapter->name, "AT91");
adapter->algo = &at91_algorithm;
adapter->class = I2C_CLASS_HWMON;
adapter->dev.parent = &pdev->dev;
platform_set_drvdata(pdev, adapter);
clk_enable(twi_clk); /* enable peripheral clock */
at91_twi_hwinit(); /* initialize TWI controller */
rc = i2c_add_adapter(adapter);
if (rc) {
dev_err(&pdev->dev, "Adapter %s registration failed\n",
adapter->name);
goto fail3;
}
dev_info(&pdev->dev, "AT91 i2c bus driver.\n");
return 0;
fail3:
platform_set_drvdata(pdev, NULL);
kfree(adapter);
clk_disable(twi_clk);
fail2:
clk_put(twi_clk);
fail1:
iounmap(twi_base);
fail0:
release_mem_region(res->start, res->end - res->start + 1);
return rc;
}
static int __devexit at91_i2c_remove(struct platform_device *pdev)
{
struct i2c_adapter *adapter = platform_get_drvdata(pdev);
struct resource *res;
int rc;
rc = i2c_del_adapter(adapter);
platform_set_drvdata(pdev, NULL);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
iounmap(twi_base);
release_mem_region(res->start, res->end - res->start + 1);
clk_disable(twi_clk); /* disable peripheral clock */
clk_put(twi_clk);
return rc;
}
#ifdef CONFIG_PM
/* NOTE: could save a few mA by keeping clock off outside of at91_xfer... */
static int at91_i2c_suspend(struct platform_device *pdev, pm_message_t mesg)
{
clk_disable(twi_clk);
return 0;
}
static int at91_i2c_resume(struct platform_device *pdev)
{
return clk_enable(twi_clk);
}
#else
#define at91_i2c_suspend NULL
#define at91_i2c_resume NULL
#endif
static struct platform_driver at91_i2c_driver = {
.probe = at91_i2c_probe,
.remove = __devexit_p(at91_i2c_remove),
.suspend = at91_i2c_suspend,
.resume = at91_i2c_resume,
.driver = {
.name = "at91_i2c",
.owner = THIS_MODULE,
},
};
static int __init at91_i2c_init(void)
{
return platform_driver_register(&at91_i2c_driver);
}
static void __exit at91_i2c_exit(void)
{
platform_driver_unregister(&at91_i2c_driver);
}
module_init(at91_i2c_init);
module_exit(at91_i2c_exit);
MODULE_AUTHOR("Rick Bronson");
MODULE_DESCRIPTION("I2C (TWI) driver for Atmel AT91");
MODULE_LICENSE("GPL");
...@@ -293,7 +293,7 @@ static int __init i2c_pcfisa_init(void) ...@@ -293,7 +293,7 @@ static int __init i2c_pcfisa_init(void)
static void i2c_pcfisa_exit(void) static void i2c_pcfisa_exit(void)
{ {
i2c_pcf_del_bus(&pcf_isa_ops); i2c_del_adapter(&pcf_isa_ops);
if (irq > 0) { if (irq > 0) {
disable_irq(irq); disable_irq(irq);
......
...@@ -146,7 +146,7 @@ static int __devinit hydra_probe(struct pci_dev *dev, ...@@ -146,7 +146,7 @@ static int __devinit hydra_probe(struct pci_dev *dev,
static void __devexit hydra_remove(struct pci_dev *dev) static void __devexit hydra_remove(struct pci_dev *dev)
{ {
pdregw(hydra_bit_data.data, 0); /* clear SCLK_OE and SDAT_OE */ pdregw(hydra_bit_data.data, 0); /* clear SCLK_OE and SDAT_OE */
i2c_bit_del_bus(&hydra_adap); i2c_del_adapter(&hydra_adap);
iounmap(hydra_bit_data.data); iounmap(hydra_bit_data.data);
release_mem_region(pci_resource_start(dev, 0)+ release_mem_region(pci_resource_start(dev, 0)+
offsetof(struct Hydra, CachePD), 4); offsetof(struct Hydra, CachePD), 4);
......
...@@ -470,12 +470,20 @@ static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id ...@@ -470,12 +470,20 @@ static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id
int err; int err;
I801_dev = dev; I801_dev = dev;
if ((dev->device == PCI_DEVICE_ID_INTEL_82801DB_3) || switch (dev->device) {
(dev->device == PCI_DEVICE_ID_INTEL_82801EB_3) || case PCI_DEVICE_ID_INTEL_82801DB_3:
(dev->device == PCI_DEVICE_ID_INTEL_ESB_4)) case PCI_DEVICE_ID_INTEL_82801EB_3:
case PCI_DEVICE_ID_INTEL_ESB_4:
case PCI_DEVICE_ID_INTEL_ICH6_16:
case PCI_DEVICE_ID_INTEL_ICH7_17:
case PCI_DEVICE_ID_INTEL_ESB2_17:
case PCI_DEVICE_ID_INTEL_ICH8_5:
case PCI_DEVICE_ID_INTEL_ICH9_6:
isich4 = 1; isich4 = 1;
else break;
default:
isich4 = 0; isich4 = 0;
}
err = pci_enable_device(dev); err = pci_enable_device(dev);
if (err) { if (err) {
......
...@@ -219,14 +219,14 @@ static int __devinit i810_probe(struct pci_dev *dev, const struct pci_device_id ...@@ -219,14 +219,14 @@ static int __devinit i810_probe(struct pci_dev *dev, const struct pci_device_id
return retval; return retval;
retval = i2c_bit_add_bus(&i810_ddc_adapter); retval = i2c_bit_add_bus(&i810_ddc_adapter);
if (retval) if (retval)
i2c_bit_del_bus(&i810_i2c_adapter); i2c_del_adapter(&i810_i2c_adapter);
return retval; return retval;
} }
static void __devexit i810_remove(struct pci_dev *dev) static void __devexit i810_remove(struct pci_dev *dev)
{ {
i2c_bit_del_bus(&i810_ddc_adapter); i2c_del_adapter(&i810_ddc_adapter);
i2c_bit_del_bus(&i810_i2c_adapter); i2c_del_adapter(&i810_i2c_adapter);
iounmap(ioaddr); iounmap(ioaddr);
} }
......
...@@ -680,6 +680,12 @@ static int __devinit iic_probe(struct ocp_device *ocp){ ...@@ -680,6 +680,12 @@ static int __devinit iic_probe(struct ocp_device *ocp){
dev->idx = ocp->def->index; dev->idx = ocp->def->index;
ocp_set_drvdata(ocp, dev); ocp_set_drvdata(ocp, dev);
if (!request_mem_region(ocp->def->paddr, sizeof(struct iic_regs),
"ibm_iic")) {
ret = -EBUSY;
goto fail1;
}
if (!(dev->vaddr = ioremap(ocp->def->paddr, sizeof(struct iic_regs)))){ if (!(dev->vaddr = ioremap(ocp->def->paddr, sizeof(struct iic_regs)))){
printk(KERN_CRIT "ibm-iic%d: failed to ioremap device registers\n", printk(KERN_CRIT "ibm-iic%d: failed to ioremap device registers\n",
dev->idx); dev->idx);
...@@ -750,6 +756,8 @@ static int __devinit iic_probe(struct ocp_device *ocp){ ...@@ -750,6 +756,8 @@ static int __devinit iic_probe(struct ocp_device *ocp){
iounmap(dev->vaddr); iounmap(dev->vaddr);
fail2: fail2:
release_mem_region(ocp->def->paddr, sizeof(struct iic_regs));
fail1:
ocp_set_drvdata(ocp, NULL); ocp_set_drvdata(ocp, NULL);
kfree(dev); kfree(dev);
return ret; return ret;
...@@ -777,6 +785,7 @@ static void __devexit iic_remove(struct ocp_device *ocp) ...@@ -777,6 +785,7 @@ static void __devexit iic_remove(struct ocp_device *ocp)
free_irq(dev->irq, dev); free_irq(dev->irq, dev);
} }
iounmap(dev->vaddr); iounmap(dev->vaddr);
release_mem_region(ocp->def->paddr, sizeof(struct iic_regs));
kfree(dev); kfree(dev);
} }
} }
......
/*
-------------------------------------------------------------------------
i2c-adap-ite.c i2c-hw access for the IIC peripheral on the ITE MIPS system
-------------------------------------------------------------------------
Hai-Pao Fan, MontaVista Software, Inc.
hpfan@mvista.com or source@mvista.com
Copyright 2001 MontaVista Software Inc.
----------------------------------------------------------------------------
This file was highly leveraged from i2c-elektor.c, which was created
by Simon G. Vogl and Hans Berglund:
Copyright (C) 1995-97 Simon G. Vogl
1998-99 Hans Berglund
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* ------------------------------------------------------------------------- */
/* With some changes from Kysti Mlkki <kmalkki@cc.hut.fi> and even
Frodo Looijaard <frodol@dds.nl> */
#include <linux/kernel.h>
#include <linux/ioport.h>
#include <linux/module.h>
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/wait.h>
#include <asm/irq.h>
#include <asm/io.h>
#include <linux/i2c.h>
#include <linux/i2c-algo-ite.h>
#include <linux/i2c-adap-ite.h>
#include "../i2c-ite.h"
#define DEFAULT_BASE 0x14014030
#define ITE_IIC_IO_SIZE 0x40
#define DEFAULT_IRQ 0
#define DEFAULT_CLOCK 0x1b0e /* default 16MHz/(27+14) = 400KHz */
#define DEFAULT_OWN 0x55
static int base;
static int irq;
static int clock;
static int own;
static struct iic_ite gpi;
static wait_queue_head_t iic_wait;
static int iic_pending;
static spinlock_t lock;
/* ----- local functions ---------------------------------------------- */
static void iic_ite_setiic(void *data, int ctl, short val)
{
unsigned long j = jiffies + 10;
pr_debug(" Write 0x%02x to 0x%x\n",(unsigned short)val, ctl&0xff);
#ifdef DEBUG
while (time_before(jiffies, j))
schedule();
#endif
outw(val,ctl);
}
static short iic_ite_getiic(void *data, int ctl)
{
short val;
val = inw(ctl);
pr_debug("Read 0x%02x from 0x%x\n",(unsigned short)val, ctl&0xff);
return (val);
}
/* Return our slave address. This is the address
* put on the I2C bus when another master on the bus wants to address us
* as a slave
*/
static int iic_ite_getown(void *data)
{
return (gpi.iic_own);
}
static int iic_ite_getclock(void *data)
{
return (gpi.iic_clock);
}
/* Put this process to sleep. We will wake up when the
* IIC controller interrupts.
*/
static void iic_ite_waitforpin(void) {
DEFINE_WAIT(wait);
int timeout = 2;
unsigned long flags;
/* If interrupts are enabled (which they are), then put the process to
* sleep. This process will be awakened by two events -- either the
* the IIC peripheral interrupts or the timeout expires.
* If interrupts are not enabled then delay for a reasonable amount
* of time and return.
*/
if (gpi.iic_irq > 0) {
spin_lock_irqsave(&lock, flags);
if (iic_pending == 0) {
spin_unlock_irqrestore(&lock, flags);
prepare_to_wait(&iic_wait, &wait, TASK_INTERRUPTIBLE);
if (schedule_timeout(timeout*HZ)) {
spin_lock_irqsave(&lock, flags);
if (iic_pending == 1) {
iic_pending = 0;
}
spin_unlock_irqrestore(&lock, flags);
}
finish_wait(&iic_wait, &wait);
} else {
iic_pending = 0;
spin_unlock_irqrestore(&lock, flags);
}
} else {
udelay(100);
}
}
static irqreturn_t iic_ite_handler(int this_irq, void *dev_id)
{
spin_lock(&lock);
iic_pending = 1;
spin_unlock(&lock);
wake_up_interruptible(&iic_wait);
return IRQ_HANDLED;
}
/* Lock the region of memory where I/O registers exist. Request our
* interrupt line and register its associated handler.
*/
static int iic_hw_resrc_init(void)
{
if (!request_region(gpi.iic_base, ITE_IIC_IO_SIZE, "i2c"))
return -ENODEV;
if (gpi.iic_irq <= 0)
return 0;
if (request_irq(gpi.iic_irq, iic_ite_handler, 0, "ITE IIC", 0) < 0)
gpi.iic_irq = 0;
else
enable_irq(gpi.iic_irq);
return 0;
}
static void iic_ite_release(void)
{
if (gpi.iic_irq > 0) {
disable_irq(gpi.iic_irq);
free_irq(gpi.iic_irq, 0);
}
release_region(gpi.iic_base , 2);
}
/* ------------------------------------------------------------------------
* Encapsulate the above functions in the correct operations structure.
* This is only done when more than one hardware adapter is supported.
*/
static struct i2c_algo_iic_data iic_ite_data = {
NULL,
iic_ite_setiic,
iic_ite_getiic,
iic_ite_getown,
iic_ite_getclock,
iic_ite_waitforpin,
80, 80, 100, /* waits, timeout */
};
static struct i2c_adapter iic_ite_ops = {
.owner = THIS_MODULE,
.id = I2C_HW_I_IIC,
.algo_data = &iic_ite_data,
.name = "ITE IIC adapter",
};
/* Called when the module is loaded. This function starts the
* cascade of calls up through the hierarchy of i2c modules (i.e. up to the
* algorithm layer and into to the core layer)
*/
static int __init iic_ite_init(void)
{
struct iic_ite *piic = &gpi;
printk(KERN_INFO "Initialize ITE IIC adapter module\n");
if (base == 0)
piic->iic_base = DEFAULT_BASE;
else
piic->iic_base = base;
if (irq == 0)
piic->iic_irq = DEFAULT_IRQ;
else
piic->iic_irq = irq;
if (clock == 0)
piic->iic_clock = DEFAULT_CLOCK;
else
piic->iic_clock = clock;
if (own == 0)
piic->iic_own = DEFAULT_OWN;
else
piic->iic_own = own;
iic_ite_data.data = (void *)piic;
init_waitqueue_head(&iic_wait);
spin_lock_init(&lock);
if (iic_hw_resrc_init() == 0) {
if (i2c_iic_add_bus(&iic_ite_ops) < 0)
return -ENODEV;
} else {
return -ENODEV;
}
printk(KERN_INFO " found device at %#x irq %d.\n",
piic->iic_base, piic->iic_irq);
return 0;
}
static void iic_ite_exit(void)
{
i2c_iic_del_bus(&iic_ite_ops);
iic_ite_release();
}
/* If modules is NOT defined when this file is compiled, then the MODULE_*
* macros will resolve to nothing
*/
MODULE_AUTHOR("MontaVista Software <www.mvista.com>");
MODULE_DESCRIPTION("I2C-Bus adapter routines for ITE IIC bus adapter");
MODULE_LICENSE("GPL");
module_param(base, int, 0);
module_param(irq, int, 0);
module_param(clock, int, 0);
module_param(own, int, 0);
/* Called when module is loaded or when kernel is initialized.
* If MODULES is defined when this file is compiled, then this function will
* resolve to init_module (the function called when insmod is invoked for a
* module). Otherwise, this function is called early in the boot, when the
* kernel is intialized. Check out /include/init.h to see how this works.
*/
module_init(iic_ite_init);
/* Resolves to module_cleanup when MODULES is defined. */
module_exit(iic_ite_exit);
...@@ -90,7 +90,7 @@ static int ixp2000_i2c_remove(struct platform_device *plat_dev) ...@@ -90,7 +90,7 @@ static int ixp2000_i2c_remove(struct platform_device *plat_dev)
platform_set_drvdata(plat_dev, NULL); platform_set_drvdata(plat_dev, NULL);
i2c_bit_del_bus(&drv_data->adapter); i2c_del_adapter(&drv_data->adapter);
kfree(drv_data); kfree(drv_data);
......
...@@ -91,7 +91,7 @@ static int ixp4xx_i2c_remove(struct platform_device *plat_dev) ...@@ -91,7 +91,7 @@ static int ixp4xx_i2c_remove(struct platform_device *plat_dev)
platform_set_drvdata(plat_dev, NULL); platform_set_drvdata(plat_dev, NULL);
i2c_bit_del_bus(&drv_data->adapter); i2c_del_adapter(&drv_data->adapter);
kfree(drv_data); kfree(drv_data);
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
nForce4 MCP55 0368 nForce4 MCP55 0368
This driver supports the 2 SMBuses that are included in the MCP of the This driver supports the 2 SMBuses that are included in the MCP of the
nForce2/3/4 chipsets. nForce2/3/4/5xx chipsets.
*/ */
/* Note: we assume there can only be one nForce2, with two SMBus interfaces */ /* Note: we assume there can only be one nForce2, with two SMBus interfaces */
...@@ -52,8 +52,8 @@ ...@@ -52,8 +52,8 @@
#include <asm/io.h> #include <asm/io.h>
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_AUTHOR ("Hans-Frieder Vogt <hfvogt@arcor.de>"); MODULE_AUTHOR ("Hans-Frieder Vogt <hfvogt@gmx.net>");
MODULE_DESCRIPTION("nForce2 SMBus driver"); MODULE_DESCRIPTION("nForce2/3/4/5xx SMBus driver");
struct nforce2_smbus { struct nforce2_smbus {
...@@ -80,9 +80,6 @@ struct nforce2_smbus { ...@@ -80,9 +80,6 @@ struct nforce2_smbus {
#define NVIDIA_SMB_ADDR (smbus->base + 0x02) /* address */ #define NVIDIA_SMB_ADDR (smbus->base + 0x02) /* address */
#define NVIDIA_SMB_CMD (smbus->base + 0x03) /* command */ #define NVIDIA_SMB_CMD (smbus->base + 0x03) /* command */
#define NVIDIA_SMB_DATA (smbus->base + 0x04) /* 32 data registers */ #define NVIDIA_SMB_DATA (smbus->base + 0x04) /* 32 data registers */
#define NVIDIA_SMB_BCNT (smbus->base + 0x24) /* number of data bytes */
#define NVIDIA_SMB_ALRM_A (smbus->base + 0x25) /* alarm address */
#define NVIDIA_SMB_ALRM_D (smbus->base + 0x26) /* 2 bytes alarm data */
#define NVIDIA_SMB_STS_DONE 0x80 #define NVIDIA_SMB_STS_DONE 0x80
#define NVIDIA_SMB_STS_ALRM 0x40 #define NVIDIA_SMB_STS_ALRM 0x40
...@@ -95,40 +92,17 @@ struct nforce2_smbus { ...@@ -95,40 +92,17 @@ struct nforce2_smbus {
#define NVIDIA_SMB_PRTCL_BYTE 0x04 #define NVIDIA_SMB_PRTCL_BYTE 0x04
#define NVIDIA_SMB_PRTCL_BYTE_DATA 0x06 #define NVIDIA_SMB_PRTCL_BYTE_DATA 0x06
#define NVIDIA_SMB_PRTCL_WORD_DATA 0x08 #define NVIDIA_SMB_PRTCL_WORD_DATA 0x08
#define NVIDIA_SMB_PRTCL_BLOCK_DATA 0x0a
#define NVIDIA_SMB_PRTCL_PROC_CALL 0x0c
#define NVIDIA_SMB_PRTCL_BLOCK_PROC_CALL 0x0d
#define NVIDIA_SMB_PRTCL_I2C_BLOCK_DATA 0x4a
#define NVIDIA_SMB_PRTCL_PEC 0x80 #define NVIDIA_SMB_PRTCL_PEC 0x80
static struct pci_driver nforce2_driver; static struct pci_driver nforce2_driver;
static s32 nforce2_access(struct i2c_adapter *adap, u16 addr, /* Return -1 on error */
unsigned short flags, char read_write,
u8 command, int size, union i2c_smbus_data *data);
static u32 nforce2_func(struct i2c_adapter *adapter);
static const struct i2c_algorithm smbus_algorithm = {
.smbus_xfer = nforce2_access,
.functionality = nforce2_func,
};
static struct i2c_adapter nforce2_adapter = {
.owner = THIS_MODULE,
.class = I2C_CLASS_HWMON,
.algo = &smbus_algorithm,
};
/* Return -1 on error. See smbus.h for more information */
static s32 nforce2_access(struct i2c_adapter * adap, u16 addr, static s32 nforce2_access(struct i2c_adapter * adap, u16 addr,
unsigned short flags, char read_write, unsigned short flags, char read_write,
u8 command, int size, union i2c_smbus_data * data) u8 command, int size, union i2c_smbus_data * data)
{ {
struct nforce2_smbus *smbus = adap->algo_data; struct nforce2_smbus *smbus = adap->algo_data;
unsigned char protocol, pec, temp; unsigned char protocol, pec, temp;
unsigned char len = 0; /* to keep the compiler quiet */
int i;
protocol = (read_write == I2C_SMBUS_READ) ? NVIDIA_SMB_PRTCL_READ : protocol = (read_write == I2C_SMBUS_READ) ? NVIDIA_SMB_PRTCL_READ :
NVIDIA_SMB_PRTCL_WRITE; NVIDIA_SMB_PRTCL_WRITE;
...@@ -163,35 +137,6 @@ static s32 nforce2_access(struct i2c_adapter * adap, u16 addr, ...@@ -163,35 +137,6 @@ static s32 nforce2_access(struct i2c_adapter * adap, u16 addr,
protocol |= NVIDIA_SMB_PRTCL_WORD_DATA | pec; protocol |= NVIDIA_SMB_PRTCL_WORD_DATA | pec;
break; break;
case I2C_SMBUS_BLOCK_DATA:
outb_p(command, NVIDIA_SMB_CMD);
if (read_write == I2C_SMBUS_WRITE) {
len = min_t(u8, data->block[0], 32);
outb_p(len, NVIDIA_SMB_BCNT);
for (i = 0; i < len; i++)
outb_p(data->block[i + 1], NVIDIA_SMB_DATA+i);
}
protocol |= NVIDIA_SMB_PRTCL_BLOCK_DATA | pec;
break;
case I2C_SMBUS_I2C_BLOCK_DATA:
len = min_t(u8, data->block[0], 32);
outb_p(command, NVIDIA_SMB_CMD);
outb_p(len, NVIDIA_SMB_BCNT);
if (read_write == I2C_SMBUS_WRITE)
for (i = 0; i < len; i++)
outb_p(data->block[i + 1], NVIDIA_SMB_DATA+i);
protocol |= NVIDIA_SMB_PRTCL_I2C_BLOCK_DATA;
break;
case I2C_SMBUS_PROC_CALL:
dev_err(&adap->dev, "I2C_SMBUS_PROC_CALL not supported!\n");
return -1;
case I2C_SMBUS_BLOCK_PROC_CALL:
dev_err(&adap->dev, "I2C_SMBUS_BLOCK_PROC_CALL not supported!\n");
return -1;
default: default:
dev_err(&adap->dev, "Unsupported transaction %d\n", size); dev_err(&adap->dev, "Unsupported transaction %d\n", size);
return -1; return -1;
...@@ -227,19 +172,8 @@ static s32 nforce2_access(struct i2c_adapter * adap, u16 addr, ...@@ -227,19 +172,8 @@ static s32 nforce2_access(struct i2c_adapter * adap, u16 addr,
break; break;
case I2C_SMBUS_WORD_DATA: case I2C_SMBUS_WORD_DATA:
/* case I2C_SMBUS_PROC_CALL: not supported */
data->word = inb_p(NVIDIA_SMB_DATA) | (inb_p(NVIDIA_SMB_DATA+1) << 8); data->word = inb_p(NVIDIA_SMB_DATA) | (inb_p(NVIDIA_SMB_DATA+1) << 8);
break; break;
case I2C_SMBUS_BLOCK_DATA:
/* case I2C_SMBUS_BLOCK_PROC_CALL: not supported */
len = inb_p(NVIDIA_SMB_BCNT);
len = min_t(u8, len, 32);
case I2C_SMBUS_I2C_BLOCK_DATA:
for (i = 0; i < len; i++)
data->block[i+1] = inb_p(NVIDIA_SMB_DATA + i);
data->block[0] = len;
break;
} }
return 0; return 0;
...@@ -250,10 +184,14 @@ static u32 nforce2_func(struct i2c_adapter *adapter) ...@@ -250,10 +184,14 @@ static u32 nforce2_func(struct i2c_adapter *adapter)
{ {
/* other functionality might be possible, but is not tested */ /* other functionality might be possible, but is not tested */
return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE |
I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA /* | I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA;
I2C_FUNC_SMBUS_BLOCK_DATA */;
} }
static struct i2c_algorithm smbus_algorithm = {
.smbus_xfer = nforce2_access,
.functionality = nforce2_func,
};
static struct pci_device_id nforce2_ids[] = { static struct pci_device_id nforce2_ids[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2_SMBUS) }, { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2_SMBUS) },
...@@ -267,7 +205,6 @@ static struct pci_device_id nforce2_ids[] = { ...@@ -267,7 +205,6 @@ static struct pci_device_id nforce2_ids[] = {
{ 0 } { 0 }
}; };
MODULE_DEVICE_TABLE (pci, nforce2_ids); MODULE_DEVICE_TABLE (pci, nforce2_ids);
...@@ -291,7 +228,7 @@ static int __devinit nforce2_probe_smb (struct pci_dev *dev, int bar, ...@@ -291,7 +228,7 @@ static int __devinit nforce2_probe_smb (struct pci_dev *dev, int bar,
} }
smbus->base = iobase & PCI_BASE_ADDRESS_IO_MASK; smbus->base = iobase & PCI_BASE_ADDRESS_IO_MASK;
smbus->size = 8; smbus->size = 64;
} }
smbus->dev = dev; smbus->dev = dev;
...@@ -300,7 +237,9 @@ static int __devinit nforce2_probe_smb (struct pci_dev *dev, int bar, ...@@ -300,7 +237,9 @@ static int __devinit nforce2_probe_smb (struct pci_dev *dev, int bar,
smbus->base, smbus->base+smbus->size-1, name); smbus->base, smbus->base+smbus->size-1, name);
return -1; return -1;
} }
smbus->adapter = nforce2_adapter; smbus->adapter.owner = THIS_MODULE;
smbus->adapter.class = I2C_CLASS_HWMON;
smbus->adapter.algo = &smbus_algorithm;
smbus->adapter.algo_data = smbus; smbus->adapter.algo_data = smbus;
smbus->adapter.dev.parent = &dev->dev; smbus->adapter.dev.parent = &dev->dev;
snprintf(smbus->adapter.name, I2C_NAME_SIZE, snprintf(smbus->adapter.name, I2C_NAME_SIZE,
......
...@@ -231,8 +231,8 @@ static int omap_i2c_init(struct omap_i2c_dev *dev) ...@@ -231,8 +231,8 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
* 13 2 1 * 13 2 1
* 19.2 2 1 * 19.2 2 1
*/ */
if (fclk_rate > 16000000) if (fclk_rate > 12000000)
psc = (fclk_rate + 8000000) / 12000000; psc = fclk_rate / 12000000;
} }
/* Setup clock prescaler to obtain approx 12MHz I2C module clock: */ /* Setup clock prescaler to obtain approx 12MHz I2C module clock: */
......
...@@ -163,7 +163,7 @@ static void __exit i2c_parport_exit(void) ...@@ -163,7 +163,7 @@ static void __exit i2c_parport_exit(void)
if (adapter_parm[type].init.val) if (adapter_parm[type].init.val)
line_set(0, &adapter_parm[type].init); line_set(0, &adapter_parm[type].init);
i2c_bit_del_bus(&parport_adapter); i2c_del_adapter(&parport_adapter);
release_region(base, 3); release_region(base, 3);
} }
......
...@@ -218,7 +218,7 @@ static void i2c_parport_detach (struct parport *port) ...@@ -218,7 +218,7 @@ static void i2c_parport_detach (struct parport *port)
if (adapter_parm[type].init.val) if (adapter_parm[type].init.val)
line_set(port, 0, &adapter_parm[type].init); line_set(port, 0, &adapter_parm[type].init);
i2c_bit_del_bus(&adapter->adapter); i2c_del_adapter(&adapter->adapter);
parport_unregister_device(adapter->pdev); parport_unregister_device(adapter->pdev);
if (prev) if (prev)
prev->next = adapter->next; prev->next = adapter->next;
......
...@@ -156,7 +156,7 @@ static int __init pca_isa_init(void) ...@@ -156,7 +156,7 @@ static int __init pca_isa_init(void)
static void pca_isa_exit(void) static void pca_isa_exit(void)
{ {
i2c_pca_del_bus(&pca_isa_ops); i2c_del_adapter(&pca_isa_ops);
if (irq > 0) { if (irq > 0) {
disable_irq(irq); disable_irq(irq);
......
This diff is collapsed.
...@@ -212,7 +212,7 @@ static void prosavage_remove(struct pci_dev *dev) ...@@ -212,7 +212,7 @@ static void prosavage_remove(struct pci_dev *dev)
if (chip->i2c_bus[i].adap_ok == 0) if (chip->i2c_bus[i].adap_ok == 0)
continue; continue;
ret = i2c_bit_del_bus(&chip->i2c_bus[i].adap); ret = i2c_del_adapter(&chip->i2c_bus[i].adap);
if (ret) { if (ret) {
dev_err(&dev->dev, "%s not removed\n", dev_err(&dev->dev, "%s not removed\n",
chip->i2c_bus[i].adap.name); chip->i2c_bus[i].adap.name);
......
...@@ -173,7 +173,7 @@ static int __devinit savage4_probe(struct pci_dev *dev, const struct pci_device_ ...@@ -173,7 +173,7 @@ static int __devinit savage4_probe(struct pci_dev *dev, const struct pci_device_
static void __devexit savage4_remove(struct pci_dev *dev) static void __devexit savage4_remove(struct pci_dev *dev)
{ {
i2c_bit_del_bus(&savage4_i2c_adapter); i2c_del_adapter(&savage4_i2c_adapter);
iounmap(ioaddr); iounmap(ioaddr);
} }
......
/*
* i2c-versatile.c
*
* Copyright (C) 2006 ARM Ltd.
* written by Russell King, Deep Blue Solutions Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/i2c.h>
#include <linux/i2c-algo-bit.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <asm/io.h>
#define I2C_CONTROL 0x00
#define I2C_CONTROLS 0x00
#define I2C_CONTROLC 0x04
#define SCL (1 << 0)
#define SDA (1 << 1)
struct i2c_versatile {
struct i2c_adapter adap;
struct i2c_algo_bit_data algo;
void __iomem *base;
};
static void i2c_versatile_setsda(void *data, int state)
{
struct i2c_versatile *i2c = data;
writel(SDA, i2c->base + (state ? I2C_CONTROLS : I2C_CONTROLC));
}
static void i2c_versatile_setscl(void *data, int state)
{
struct i2c_versatile *i2c = data;
writel(SCL, i2c->base + (state ? I2C_CONTROLS : I2C_CONTROLC));
}
static int i2c_versatile_getsda(void *data)
{
struct i2c_versatile *i2c = data;
return !!(readl(i2c->base + I2C_CONTROL) & SDA);
}
static int i2c_versatile_getscl(void *data)
{
struct i2c_versatile *i2c = data;
return !!(readl(i2c->base + I2C_CONTROL) & SCL);
}
static struct i2c_algo_bit_data i2c_versatile_algo = {
.setsda = i2c_versatile_setsda,
.setscl = i2c_versatile_setscl,
.getsda = i2c_versatile_getsda,
.getscl = i2c_versatile_getscl,
.udelay = 30,
.timeout = HZ,
};
static int i2c_versatile_probe(struct platform_device *dev)
{
struct i2c_versatile *i2c;
struct resource *r;
int ret;
r = platform_get_resource(dev, IORESOURCE_MEM, 0);
if (!r) {
ret = -EINVAL;
goto err_out;
}
if (!request_mem_region(r->start, r->end - r->start + 1, "versatile-i2c")) {
ret = -EBUSY;
goto err_out;
}
i2c = kzalloc(sizeof(struct i2c_versatile), GFP_KERNEL);
if (!i2c) {
ret = -ENOMEM;
goto err_release;
}
i2c->base = ioremap(r->start, r->end - r->start + 1);
if (!i2c->base) {
ret = -ENOMEM;
goto err_free;
}
writel(SCL | SDA, i2c->base + I2C_CONTROLS);
i2c->adap.owner = THIS_MODULE;
strlcpy(i2c->adap.name, "Versatile I2C adapter", sizeof(i2c->adap.name));
i2c->adap.algo_data = &i2c->algo;
i2c->adap.dev.parent = &dev->dev;
i2c->algo = i2c_versatile_algo;
i2c->algo.data = i2c;
ret = i2c_bit_add_bus(&i2c->adap);
if (ret >= 0) {
platform_set_drvdata(dev, i2c);
return 0;
}
iounmap(i2c->base);
err_free:
kfree(i2c);
err_release:
release_mem_region(r->start, r->end - r->start + 1);
err_out:
return ret;
}
static int i2c_versatile_remove(struct platform_device *dev)
{
struct i2c_versatile *i2c = platform_get_drvdata(dev);
platform_set_drvdata(dev, NULL);
i2c_del_adapter(&i2c->adap);
return 0;
}
static struct platform_driver i2c_versatile_driver = {
.probe = i2c_versatile_probe,
.remove = i2c_versatile_remove,
.driver = {
.name = "versatile-i2c",
.owner = THIS_MODULE,
},
};
static int __init i2c_versatile_init(void)
{
return platform_driver_register(&i2c_versatile_driver);
}
static void __exit i2c_versatile_exit(void)
{
platform_driver_unregister(&i2c_versatile_driver);
}
module_init(i2c_versatile_init);
module_exit(i2c_versatile_exit);
MODULE_DESCRIPTION("ARM Versatile I2C bus driver");
MODULE_LICENSE("GPL");
...@@ -151,7 +151,7 @@ static int __devinit vt586b_probe(struct pci_dev *dev, const struct pci_device_i ...@@ -151,7 +151,7 @@ static int __devinit vt586b_probe(struct pci_dev *dev, const struct pci_device_i
static void __devexit vt586b_remove(struct pci_dev *dev) static void __devexit vt586b_remove(struct pci_dev *dev)
{ {
i2c_bit_del_bus(&vt586b_adapter); i2c_del_adapter(&vt586b_adapter);
release_region(I2C_DIR, IOSPACE); release_region(I2C_DIR, IOSPACE);
pm_io_base = 0; pm_io_base = 0;
} }
......
...@@ -211,14 +211,14 @@ static int __devinit voodoo3_probe(struct pci_dev *dev, const struct pci_device_ ...@@ -211,14 +211,14 @@ static int __devinit voodoo3_probe(struct pci_dev *dev, const struct pci_device_
return retval; return retval;
retval = i2c_bit_add_bus(&voodoo3_ddc_adapter); retval = i2c_bit_add_bus(&voodoo3_ddc_adapter);
if (retval) if (retval)
i2c_bit_del_bus(&voodoo3_i2c_adapter); i2c_del_adapter(&voodoo3_i2c_adapter);
return retval; return retval;
} }
static void __devexit voodoo3_remove(struct pci_dev *dev) static void __devexit voodoo3_remove(struct pci_dev *dev)
{ {
i2c_bit_del_bus(&voodoo3_i2c_adapter); i2c_del_adapter(&voodoo3_i2c_adapter);
i2c_bit_del_bus(&voodoo3_ddc_adapter); i2c_del_adapter(&voodoo3_ddc_adapter);
iounmap(ioaddr); iounmap(ioaddr);
} }
......
...@@ -116,7 +116,7 @@ static int scx200_i2c_init(void) ...@@ -116,7 +116,7 @@ static int scx200_i2c_init(void)
static void scx200_i2c_cleanup(void) static void scx200_i2c_cleanup(void)
{ {
i2c_bit_del_bus(&scx200_i2c_ops); i2c_del_adapter(&scx200_i2c_ops);
} }
module_init(scx200_i2c_init); module_init(scx200_i2c_init);
......
...@@ -347,13 +347,19 @@ static void ds1337_init_client(struct i2c_client *client) ...@@ -347,13 +347,19 @@ static void ds1337_init_client(struct i2c_client *client)
if ((status & 0x80) || (control & 0x80)) { if ((status & 0x80) || (control & 0x80)) {
/* RTC not running */ /* RTC not running */
u8 buf[16]; u8 buf[1+16]; /* First byte is interpreted as address */
struct i2c_msg msg[1]; struct i2c_msg msg[1];
dev_dbg(&client->dev, "%s: RTC not running!\n", __FUNCTION__); dev_dbg(&client->dev, "%s: RTC not running!\n", __FUNCTION__);
/* Initialize all, including STATUS and CONTROL to zero */ /* Initialize all, including STATUS and CONTROL to zero */
memset(buf, 0, sizeof(buf)); memset(buf, 0, sizeof(buf));
/* Write valid values in the date/time registers */
buf[1+DS1337_REG_DAY] = 1;
buf[1+DS1337_REG_DATE] = 1;
buf[1+DS1337_REG_MONTH] = 1;
msg[0].addr = client->addr; msg[0].addr = client->addr;
msg[0].flags = 0; msg[0].flags = 0;
msg[0].len = sizeof(buf); msg[0].len = sizeof(buf);
......
...@@ -127,20 +127,17 @@ static ssize_t show_client_name(struct device *dev, struct device_attribute *att ...@@ -127,20 +127,17 @@ static ssize_t show_client_name(struct device *dev, struct device_attribute *att
return sprintf(buf, "%s\n", client->name); return sprintf(buf, "%s\n", client->name);
} }
/* /*
* We can't use the DEVICE_ATTR() macro here as we want the same filename for a * We can't use the DEVICE_ATTR() macro here, as we used the same name for
* different type of a device. So beware if the DEVICE_ATTR() macro ever * an i2c adapter attribute (above).
* changes, this definition will also have to change.
*/ */
static struct device_attribute dev_attr_client_name = { static struct device_attribute dev_attr_client_name =
.attr = {.name = "name", .mode = S_IRUGO, .owner = THIS_MODULE }, __ATTR(name, S_IRUGO, &show_client_name, NULL);
.show = &show_client_name,
};
/* --------------------------------------------------- /* ---------------------------------------------------
* registering functions * registering functions
* --------------------------------------------------- * ---------------------------------------------------
*/ */
/* ----- /* -----
...@@ -314,7 +311,7 @@ int i2c_register_driver(struct module *owner, struct i2c_driver *driver) ...@@ -314,7 +311,7 @@ int i2c_register_driver(struct module *owner, struct i2c_driver *driver)
res = driver_register(&driver->driver); res = driver_register(&driver->driver);
if (res) if (res)
return res; return res;
mutex_lock(&core_lists); mutex_lock(&core_lists);
list_add_tail(&driver->list,&drivers); list_add_tail(&driver->list,&drivers);
...@@ -338,13 +335,13 @@ int i2c_del_driver(struct i2c_driver *driver) ...@@ -338,13 +335,13 @@ int i2c_del_driver(struct i2c_driver *driver)
struct list_head *item1, *item2, *_n; struct list_head *item1, *item2, *_n;
struct i2c_client *client; struct i2c_client *client;
struct i2c_adapter *adap; struct i2c_adapter *adap;
int res = 0; int res = 0;
mutex_lock(&core_lists); mutex_lock(&core_lists);
/* Have a look at each adapter, if clients of this driver are still /* Have a look at each adapter, if clients of this driver are still
* attached. If so, detach them to be able to kill the driver * attached. If so, detach them to be able to kill the driver
* afterwards. * afterwards.
*/ */
list_for_each(item1,&adapters) { list_for_each(item1,&adapters) {
...@@ -419,14 +416,14 @@ int i2c_attach_client(struct i2c_client *client) ...@@ -419,14 +416,14 @@ int i2c_attach_client(struct i2c_client *client)
goto out_unlock; goto out_unlock;
} }
list_add_tail(&client->list,&adapter->clients); list_add_tail(&client->list,&adapter->clients);
client->usage_count = 0; client->usage_count = 0;
client->dev.parent = &client->adapter->dev; client->dev.parent = &client->adapter->dev;
client->dev.driver = &client->driver->driver; client->dev.driver = &client->driver->driver;
client->dev.bus = &i2c_bus_type; client->dev.bus = &i2c_bus_type;
client->dev.release = &i2c_client_release; client->dev.release = &i2c_client_release;
snprintf(&client->dev.bus_id[0], sizeof(client->dev.bus_id), snprintf(&client->dev.bus_id[0], sizeof(client->dev.bus_id),
"%d-%04x", i2c_adapter_id(adapter), client->addr); "%d-%04x", i2c_adapter_id(adapter), client->addr);
dev_dbg(&adapter->dev, "client [%s] registered with bus id %s\n", dev_dbg(&adapter->dev, "client [%s] registered with bus id %s\n",
...@@ -467,7 +464,7 @@ int i2c_detach_client(struct i2c_client *client) ...@@ -467,7 +464,7 @@ int i2c_detach_client(struct i2c_client *client)
{ {
struct i2c_adapter *adapter = client->adapter; struct i2c_adapter *adapter = client->adapter;
int res = 0; int res = 0;
if (client->usage_count > 0) { if (client->usage_count > 0) {
dev_warn(&client->dev, "Client [%s] still busy, " dev_warn(&client->dev, "Client [%s] still busy, "
"can't detach\n", client->name); "can't detach\n", client->name);
...@@ -535,10 +532,10 @@ int i2c_release_client(struct i2c_client *client) ...@@ -535,10 +532,10 @@ int i2c_release_client(struct i2c_client *client)
__FUNCTION__); __FUNCTION__);
return -EPERM; return -EPERM;
} }
client->usage_count--; client->usage_count--;
i2c_dec_use_client(client); i2c_dec_use_client(client);
return 0; return 0;
} }
...@@ -603,7 +600,7 @@ int i2c_transfer(struct i2c_adapter * adap, struct i2c_msg *msgs, int num) ...@@ -603,7 +600,7 @@ int i2c_transfer(struct i2c_adapter * adap, struct i2c_msg *msgs, int num)
} }
#endif #endif
mutex_lock(&adap->bus_lock); mutex_lock_nested(&adap->bus_lock, adap->level);
ret = adap->algo->master_xfer(adap,msgs,num); ret = adap->algo->master_xfer(adap,msgs,num);
mutex_unlock(&adap->bus_lock); mutex_unlock(&adap->bus_lock);
...@@ -624,7 +621,7 @@ int i2c_master_send(struct i2c_client *client,const char *buf ,int count) ...@@ -624,7 +621,7 @@ int i2c_master_send(struct i2c_client *client,const char *buf ,int count)
msg.flags = client->flags & I2C_M_TEN; msg.flags = client->flags & I2C_M_TEN;
msg.len = count; msg.len = count;
msg.buf = (char *)buf; msg.buf = (char *)buf;
ret = i2c_transfer(adap, &msg, 1); ret = i2c_transfer(adap, &msg, 1);
/* If everything went ok (i.e. 1 msg transmitted), return #bytes /* If everything went ok (i.e. 1 msg transmitted), return #bytes
...@@ -757,7 +754,7 @@ int i2c_probe(struct i2c_adapter *adapter, ...@@ -757,7 +754,7 @@ int i2c_probe(struct i2c_adapter *adapter,
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_QUICK)) { if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_QUICK)) {
if (address_data->probe[0] == I2C_CLIENT_END if (address_data->probe[0] == I2C_CLIENT_END
&& address_data->normal_i2c[0] == I2C_CLIENT_END) && address_data->normal_i2c[0] == I2C_CLIENT_END)
return 0; return 0;
dev_warn(&adapter->dev, "SMBus Quick command not supported, " dev_warn(&adapter->dev, "SMBus Quick command not supported, "
"can't probe for chips\n"); "can't probe for chips\n");
...@@ -817,7 +814,7 @@ int i2c_probe(struct i2c_adapter *adapter, ...@@ -817,7 +814,7 @@ int i2c_probe(struct i2c_adapter *adapter,
struct i2c_adapter* i2c_get_adapter(int id) struct i2c_adapter* i2c_get_adapter(int id)
{ {
struct i2c_adapter *adapter; struct i2c_adapter *adapter;
mutex_lock(&core_lists); mutex_lock(&core_lists);
adapter = (struct i2c_adapter *)idr_find(&i2c_adapter_idr, id); adapter = (struct i2c_adapter *)idr_find(&i2c_adapter_idr, id);
if (adapter && !try_module_get(adapter->owner)) if (adapter && !try_module_get(adapter->owner))
...@@ -834,14 +831,14 @@ void i2c_put_adapter(struct i2c_adapter *adap) ...@@ -834,14 +831,14 @@ void i2c_put_adapter(struct i2c_adapter *adap)
/* The SMBus parts */ /* The SMBus parts */
#define POLY (0x1070U << 3) #define POLY (0x1070U << 3)
static u8 static u8
crc8(u16 data) crc8(u16 data)
{ {
int i; int i;
for(i = 0; i < 8; i++) { for(i = 0; i < 8; i++) {
if (data & 0x8000) if (data & 0x8000)
data = data ^ POLY; data = data ^ POLY;
data = data << 1; data = data << 1;
} }
...@@ -891,13 +888,13 @@ static int i2c_smbus_check_pec(u8 cpec, struct i2c_msg *msg) ...@@ -891,13 +888,13 @@ static int i2c_smbus_check_pec(u8 cpec, struct i2c_msg *msg)
rpec, cpec); rpec, cpec);
return -1; return -1;
} }
return 0; return 0;
} }
s32 i2c_smbus_write_quick(struct i2c_client *client, u8 value) s32 i2c_smbus_write_quick(struct i2c_client *client, u8 value)
{ {
return i2c_smbus_xfer(client->adapter,client->addr,client->flags, return i2c_smbus_xfer(client->adapter,client->addr,client->flags,
value,0,I2C_SMBUS_QUICK,NULL); value,0,I2C_SMBUS_QUICK,NULL);
} }
s32 i2c_smbus_read_byte(struct i2c_client *client) s32 i2c_smbus_read_byte(struct i2c_client *client)
...@@ -996,11 +993,11 @@ s32 i2c_smbus_write_i2c_block_data(struct i2c_client *client, u8 command, ...@@ -996,11 +993,11 @@ s32 i2c_smbus_write_i2c_block_data(struct i2c_client *client, u8 command,
I2C_SMBUS_I2C_BLOCK_DATA, &data); I2C_SMBUS_I2C_BLOCK_DATA, &data);
} }
/* Simulate a SMBus command using the i2c protocol /* Simulate a SMBus command using the i2c protocol
No checking of parameters is done! */ No checking of parameters is done! */
static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr, static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr,
unsigned short flags, unsigned short flags,
char read_write, u8 command, int size, char read_write, u8 command, int size,
union i2c_smbus_data * data) union i2c_smbus_data * data)
{ {
/* So we need to generate a series of msgs. In the case of writing, we /* So we need to generate a series of msgs. In the case of writing, we
...@@ -1010,7 +1007,7 @@ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr, ...@@ -1010,7 +1007,7 @@ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr,
unsigned char msgbuf0[I2C_SMBUS_BLOCK_MAX+3]; unsigned char msgbuf0[I2C_SMBUS_BLOCK_MAX+3];
unsigned char msgbuf1[I2C_SMBUS_BLOCK_MAX+2]; unsigned char msgbuf1[I2C_SMBUS_BLOCK_MAX+2];
int num = read_write == I2C_SMBUS_READ?2:1; int num = read_write == I2C_SMBUS_READ?2:1;
struct i2c_msg msg[2] = { { addr, flags, 1, msgbuf0 }, struct i2c_msg msg[2] = { { addr, flags, 1, msgbuf0 },
{ addr, flags | I2C_M_RD, 0, msgbuf1 } { addr, flags | I2C_M_RD, 0, msgbuf1 }
}; };
int i; int i;
...@@ -1103,14 +1100,14 @@ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr, ...@@ -1103,14 +1100,14 @@ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr,
if (i) { if (i) {
/* Compute PEC if first message is a write */ /* Compute PEC if first message is a write */
if (!(msg[0].flags & I2C_M_RD)) { if (!(msg[0].flags & I2C_M_RD)) {
if (num == 1) /* Write only */ if (num == 1) /* Write only */
i2c_smbus_add_pec(&msg[0]); i2c_smbus_add_pec(&msg[0]);
else /* Write followed by read */ else /* Write followed by read */
partial_pec = i2c_smbus_msg_pec(0, &msg[0]); partial_pec = i2c_smbus_msg_pec(0, &msg[0]);
} }
/* Ask for PEC if last message is a read */ /* Ask for PEC if last message is a read */
if (msg[num-1].flags & I2C_M_RD) if (msg[num-1].flags & I2C_M_RD)
msg[num-1].len++; msg[num-1].len++;
} }
if (i2c_transfer(adapter, msg, num) < 0) if (i2c_transfer(adapter, msg, num) < 0)
...@@ -1130,7 +1127,7 @@ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr, ...@@ -1130,7 +1127,7 @@ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr,
case I2C_SMBUS_BYTE_DATA: case I2C_SMBUS_BYTE_DATA:
data->byte = msgbuf1[0]; data->byte = msgbuf1[0];
break; break;
case I2C_SMBUS_WORD_DATA: case I2C_SMBUS_WORD_DATA:
case I2C_SMBUS_PROC_CALL: case I2C_SMBUS_PROC_CALL:
data->word = msgbuf1[0] | (msgbuf1[1] << 8); data->word = msgbuf1[0] | (msgbuf1[1] << 8);
break; break;
...@@ -1146,7 +1143,7 @@ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr, ...@@ -1146,7 +1143,7 @@ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr,
s32 i2c_smbus_xfer(struct i2c_adapter * adapter, u16 addr, unsigned short flags, s32 i2c_smbus_xfer(struct i2c_adapter * adapter, u16 addr, unsigned short flags,
char read_write, u8 command, int size, char read_write, u8 command, int size,
union i2c_smbus_data * data) union i2c_smbus_data * data)
{ {
s32 res; s32 res;
......
/* /*
i2c-dev.c - i2c-bus driver, char device interface i2c-dev.c - i2c-bus driver, char device interface
Copyright (C) 1995-97 Simon G. Vogl Copyright (C) 1995-97 Simon G. Vogl
Copyright (C) 1998-99 Frodo Looijaard <frodol@dds.nl> Copyright (C) 1998-99 Frodo Looijaard <frodol@dds.nl>
...@@ -90,6 +90,7 @@ static void return_i2c_dev(struct i2c_dev *i2c_dev) ...@@ -90,6 +90,7 @@ static void return_i2c_dev(struct i2c_dev *i2c_dev)
spin_lock(&i2c_dev_list_lock); spin_lock(&i2c_dev_list_lock);
list_del(&i2c_dev->list); list_del(&i2c_dev->list);
spin_unlock(&i2c_dev_list_lock); spin_unlock(&i2c_dev_list_lock);
kfree(i2c_dev);
} }
static ssize_t show_adapter_name(struct device *dev, static ssize_t show_adapter_name(struct device *dev,
...@@ -172,7 +173,7 @@ static int i2cdev_ioctl(struct inode *inode, struct file *file, ...@@ -172,7 +173,7 @@ static int i2cdev_ioctl(struct inode *inode, struct file *file,
switch ( cmd ) { switch ( cmd ) {
case I2C_SLAVE: case I2C_SLAVE:
case I2C_SLAVE_FORCE: case I2C_SLAVE_FORCE:
if ((arg > 0x3ff) || if ((arg > 0x3ff) ||
(((client->flags & I2C_M_TEN) == 0) && arg > 0x7f)) (((client->flags & I2C_M_TEN) == 0) && arg > 0x7f))
return -EINVAL; return -EINVAL;
if ((cmd == I2C_SLAVE) && i2c_check_addr(client->adapter,arg)) if ((cmd == I2C_SLAVE) && i2c_check_addr(client->adapter,arg))
...@@ -193,12 +194,11 @@ static int i2cdev_ioctl(struct inode *inode, struct file *file, ...@@ -193,12 +194,11 @@ static int i2cdev_ioctl(struct inode *inode, struct file *file,
return 0; return 0;
case I2C_FUNCS: case I2C_FUNCS:
funcs = i2c_get_functionality(client->adapter); funcs = i2c_get_functionality(client->adapter);
return (copy_to_user((unsigned long __user *)arg, &funcs, return put_user(funcs, (unsigned long __user *)arg);
sizeof(unsigned long)))?-EFAULT:0;
case I2C_RDWR: case I2C_RDWR:
if (copy_from_user(&rdwr_arg, if (copy_from_user(&rdwr_arg,
(struct i2c_rdwr_ioctl_data __user *)arg, (struct i2c_rdwr_ioctl_data __user *)arg,
sizeof(rdwr_arg))) sizeof(rdwr_arg)))
return -EFAULT; return -EFAULT;
...@@ -206,9 +206,9 @@ static int i2cdev_ioctl(struct inode *inode, struct file *file, ...@@ -206,9 +206,9 @@ static int i2cdev_ioctl(struct inode *inode, struct file *file,
* be sent at once */ * be sent at once */
if (rdwr_arg.nmsgs > I2C_RDRW_IOCTL_MAX_MSGS) if (rdwr_arg.nmsgs > I2C_RDRW_IOCTL_MAX_MSGS)
return -EINVAL; return -EINVAL;
rdwr_pa = (struct i2c_msg *) rdwr_pa = (struct i2c_msg *)
kmalloc(rdwr_arg.nmsgs * sizeof(struct i2c_msg), kmalloc(rdwr_arg.nmsgs * sizeof(struct i2c_msg),
GFP_KERNEL); GFP_KERNEL);
if (rdwr_pa == NULL) return -ENOMEM; if (rdwr_pa == NULL) return -ENOMEM;
...@@ -278,9 +278,9 @@ static int i2cdev_ioctl(struct inode *inode, struct file *file, ...@@ -278,9 +278,9 @@ static int i2cdev_ioctl(struct inode *inode, struct file *file,
(struct i2c_smbus_ioctl_data __user *) arg, (struct i2c_smbus_ioctl_data __user *) arg,
sizeof(struct i2c_smbus_ioctl_data))) sizeof(struct i2c_smbus_ioctl_data)))
return -EFAULT; return -EFAULT;
if ((data_arg.size != I2C_SMBUS_BYTE) && if ((data_arg.size != I2C_SMBUS_BYTE) &&
(data_arg.size != I2C_SMBUS_QUICK) && (data_arg.size != I2C_SMBUS_QUICK) &&
(data_arg.size != I2C_SMBUS_BYTE_DATA) && (data_arg.size != I2C_SMBUS_BYTE_DATA) &&
(data_arg.size != I2C_SMBUS_WORD_DATA) && (data_arg.size != I2C_SMBUS_WORD_DATA) &&
(data_arg.size != I2C_SMBUS_PROC_CALL) && (data_arg.size != I2C_SMBUS_PROC_CALL) &&
(data_arg.size != I2C_SMBUS_BLOCK_DATA) && (data_arg.size != I2C_SMBUS_BLOCK_DATA) &&
...@@ -291,11 +291,11 @@ static int i2cdev_ioctl(struct inode *inode, struct file *file, ...@@ -291,11 +291,11 @@ static int i2cdev_ioctl(struct inode *inode, struct file *file,
data_arg.size); data_arg.size);
return -EINVAL; return -EINVAL;
} }
/* Note that I2C_SMBUS_READ and I2C_SMBUS_WRITE are 0 and 1, /* Note that I2C_SMBUS_READ and I2C_SMBUS_WRITE are 0 and 1,
so the check is valid if size==I2C_SMBUS_QUICK too. */ so the check is valid if size==I2C_SMBUS_QUICK too. */
if ((data_arg.read_write != I2C_SMBUS_READ) && if ((data_arg.read_write != I2C_SMBUS_READ) &&
(data_arg.read_write != I2C_SMBUS_WRITE)) { (data_arg.read_write != I2C_SMBUS_WRITE)) {
dev_dbg(&client->adapter->dev, dev_dbg(&client->adapter->dev,
"read_write out of range (%x) in ioctl I2C_SMBUS.\n", "read_write out of range (%x) in ioctl I2C_SMBUS.\n",
data_arg.read_write); data_arg.read_write);
return -EINVAL; return -EINVAL;
...@@ -304,7 +304,7 @@ static int i2cdev_ioctl(struct inode *inode, struct file *file, ...@@ -304,7 +304,7 @@ static int i2cdev_ioctl(struct inode *inode, struct file *file,
/* Note that command values are always valid! */ /* Note that command values are always valid! */
if ((data_arg.size == I2C_SMBUS_QUICK) || if ((data_arg.size == I2C_SMBUS_QUICK) ||
((data_arg.size == I2C_SMBUS_BYTE) && ((data_arg.size == I2C_SMBUS_BYTE) &&
(data_arg.read_write == I2C_SMBUS_WRITE))) (data_arg.read_write == I2C_SMBUS_WRITE)))
/* These are special: we do not use data */ /* These are special: we do not use data */
return i2c_smbus_xfer(client->adapter, client->addr, return i2c_smbus_xfer(client->adapter, client->addr,
...@@ -322,14 +322,14 @@ static int i2cdev_ioctl(struct inode *inode, struct file *file, ...@@ -322,14 +322,14 @@ static int i2cdev_ioctl(struct inode *inode, struct file *file,
if ((data_arg.size == I2C_SMBUS_BYTE_DATA) || if ((data_arg.size == I2C_SMBUS_BYTE_DATA) ||
(data_arg.size == I2C_SMBUS_BYTE)) (data_arg.size == I2C_SMBUS_BYTE))
datasize = sizeof(data_arg.data->byte); datasize = sizeof(data_arg.data->byte);
else if ((data_arg.size == I2C_SMBUS_WORD_DATA) || else if ((data_arg.size == I2C_SMBUS_WORD_DATA) ||
(data_arg.size == I2C_SMBUS_PROC_CALL)) (data_arg.size == I2C_SMBUS_PROC_CALL))
datasize = sizeof(data_arg.data->word); datasize = sizeof(data_arg.data->word);
else /* size == smbus block, i2c block, or block proc. call */ else /* size == smbus block, i2c block, or block proc. call */
datasize = sizeof(data_arg.data->block); datasize = sizeof(data_arg.data->block);
if ((data_arg.size == I2C_SMBUS_PROC_CALL) || if ((data_arg.size == I2C_SMBUS_PROC_CALL) ||
(data_arg.size == I2C_SMBUS_BLOCK_PROC_CALL) || (data_arg.size == I2C_SMBUS_BLOCK_PROC_CALL) ||
(data_arg.read_write == I2C_SMBUS_WRITE)) { (data_arg.read_write == I2C_SMBUS_WRITE)) {
if (copy_from_user(&temp, data_arg.data, datasize)) if (copy_from_user(&temp, data_arg.data, datasize))
return -EFAULT; return -EFAULT;
...@@ -337,8 +337,8 @@ static int i2cdev_ioctl(struct inode *inode, struct file *file, ...@@ -337,8 +337,8 @@ static int i2cdev_ioctl(struct inode *inode, struct file *file,
res = i2c_smbus_xfer(client->adapter,client->addr,client->flags, res = i2c_smbus_xfer(client->adapter,client->addr,client->flags,
data_arg.read_write, data_arg.read_write,
data_arg.command,data_arg.size,&temp); data_arg.command,data_arg.size,&temp);
if (! res && ((data_arg.size == I2C_SMBUS_PROC_CALL) || if (! res && ((data_arg.size == I2C_SMBUS_PROC_CALL) ||
(data_arg.size == I2C_SMBUS_BLOCK_PROC_CALL) || (data_arg.size == I2C_SMBUS_BLOCK_PROC_CALL) ||
(data_arg.read_write == I2C_SMBUS_READ))) { (data_arg.read_write == I2C_SMBUS_READ))) {
if (copy_to_user(data_arg.data, &temp, datasize)) if (copy_to_user(data_arg.data, &temp, datasize))
return -EFAULT; return -EFAULT;
...@@ -417,8 +417,8 @@ static int i2cdev_attach_adapter(struct i2c_adapter *adap) ...@@ -417,8 +417,8 @@ static int i2cdev_attach_adapter(struct i2c_adapter *adap)
i2c_dev->dev = device_create(i2c_dev_class, &adap->dev, i2c_dev->dev = device_create(i2c_dev_class, &adap->dev,
MKDEV(I2C_MAJOR, adap->nr), MKDEV(I2C_MAJOR, adap->nr),
"i2c-%d", adap->nr); "i2c-%d", adap->nr);
if (!i2c_dev->dev) { if (IS_ERR(i2c_dev->dev)) {
res = -ENODEV; res = PTR_ERR(i2c_dev->dev);
goto error; goto error;
} }
res = device_create_file(i2c_dev->dev, &dev_attr_name); res = device_create_file(i2c_dev->dev, &dev_attr_name);
...@@ -432,7 +432,6 @@ static int i2cdev_attach_adapter(struct i2c_adapter *adap) ...@@ -432,7 +432,6 @@ static int i2cdev_attach_adapter(struct i2c_adapter *adap)
device_destroy(i2c_dev_class, MKDEV(I2C_MAJOR, adap->nr)); device_destroy(i2c_dev_class, MKDEV(I2C_MAJOR, adap->nr));
error: error:
return_i2c_dev(i2c_dev); return_i2c_dev(i2c_dev);
kfree(i2c_dev);
return res; return res;
} }
...@@ -447,7 +446,6 @@ static int i2cdev_detach_adapter(struct i2c_adapter *adap) ...@@ -447,7 +446,6 @@ static int i2cdev_detach_adapter(struct i2c_adapter *adap)
device_remove_file(i2c_dev->dev, &dev_attr_name); device_remove_file(i2c_dev->dev, &dev_attr_name);
return_i2c_dev(i2c_dev); return_i2c_dev(i2c_dev);
device_destroy(i2c_dev_class, MKDEV(I2C_MAJOR, adap->nr)); device_destroy(i2c_dev_class, MKDEV(I2C_MAJOR, adap->nr));
kfree(i2c_dev);
pr_debug("i2c-dev: adapter [%s] unregistered\n", adap->name); pr_debug("i2c-dev: adapter [%s] unregistered\n", adap->name);
return 0; return 0;
......
...@@ -1485,7 +1485,7 @@ static int __devinit add_card(struct pci_dev *dev, ...@@ -1485,7 +1485,7 @@ static int __devinit add_card(struct pci_dev *dev,
} }
i2c_bit_del_bus(i2c_ad); i2c_del_adapter(i2c_ad);
kfree(i2c_ad); kfree(i2c_ad);
} }
} }
......
...@@ -650,7 +650,7 @@ static int __devinit pluto2_probe(struct pci_dev *pdev, ...@@ -650,7 +650,7 @@ static int __devinit pluto2_probe(struct pci_dev *pdev,
/* dvb */ /* dvb */
ret = dvb_register_adapter(&pluto->dvb_adapter, DRIVER_NAME, THIS_MODULE, &pdev->dev); ret = dvb_register_adapter(&pluto->dvb_adapter, DRIVER_NAME, THIS_MODULE, &pdev->dev);
if (ret < 0) if (ret < 0)
goto err_i2c_bit_del_bus; goto err_i2c_del_adapter;
dvb_adapter = &pluto->dvb_adapter; dvb_adapter = &pluto->dvb_adapter;
...@@ -712,8 +712,8 @@ static int __devinit pluto2_probe(struct pci_dev *pdev, ...@@ -712,8 +712,8 @@ static int __devinit pluto2_probe(struct pci_dev *pdev,
dvb_dmx_release(dvbdemux); dvb_dmx_release(dvbdemux);
err_dvb_unregister_adapter: err_dvb_unregister_adapter:
dvb_unregister_adapter(dvb_adapter); dvb_unregister_adapter(dvb_adapter);
err_i2c_bit_del_bus: err_i2c_del_adapter:
i2c_bit_del_bus(&pluto->i2c_adap); i2c_del_adapter(&pluto->i2c_adap);
err_pluto_hw_exit: err_pluto_hw_exit:
pluto_hw_exit(pluto); pluto_hw_exit(pluto);
err_free_irq: err_free_irq:
...@@ -748,7 +748,7 @@ static void __devexit pluto2_remove(struct pci_dev *pdev) ...@@ -748,7 +748,7 @@ static void __devexit pluto2_remove(struct pci_dev *pdev)
dvb_dmxdev_release(&pluto->dmxdev); dvb_dmxdev_release(&pluto->dmxdev);
dvb_dmx_release(dvbdemux); dvb_dmx_release(dvbdemux);
dvb_unregister_adapter(dvb_adapter); dvb_unregister_adapter(dvb_adapter);
i2c_bit_del_bus(&pluto->i2c_adap); i2c_del_adapter(&pluto->i2c_adap);
pluto_hw_exit(pluto); pluto_hw_exit(pluto);
free_irq(pdev->irq, pluto); free_irq(pdev->irq, pluto);
pci_iounmap(pdev, pluto->io_mem); pci_iounmap(pdev, pluto->io_mem);
......
...@@ -479,11 +479,7 @@ int __devexit fini_bttv_i2c(struct bttv *btv) ...@@ -479,11 +479,7 @@ int __devexit fini_bttv_i2c(struct bttv *btv)
if (0 != btv->i2c_rc) if (0 != btv->i2c_rc)
return 0; return 0;
if (btv->use_i2c_hw) { return i2c_del_adapter(&btv->c.i2c_adap);
return i2c_del_adapter(&btv->c.i2c_adap);
} else {
return i2c_bit_del_bus(&btv->c.i2c_adap);
}
} }
/* /*
......
...@@ -1153,7 +1153,7 @@ void cx88_core_put(struct cx88_core *core, struct pci_dev *pci) ...@@ -1153,7 +1153,7 @@ void cx88_core_put(struct cx88_core *core, struct pci_dev *pci)
mutex_lock(&devlist); mutex_lock(&devlist);
cx88_ir_fini(core); cx88_ir_fini(core);
if (0 == core->i2c_rc) if (0 == core->i2c_rc)
i2c_bit_del_bus(&core->i2c_adap); i2c_del_adapter(&core->i2c_adap);
list_del(&core->devlist); list_del(&core->devlist);
iounmap(core->lmmio); iounmap(core->lmmio);
cx88_devcount--; cx88_devcount--;
......
...@@ -168,7 +168,7 @@ void vp3054_i2c_remove(struct cx8802_dev *dev) ...@@ -168,7 +168,7 @@ void vp3054_i2c_remove(struct cx8802_dev *dev)
dev->core->board != CX88_BOARD_DNTV_LIVE_DVB_T_PRO) dev->core->board != CX88_BOARD_DNTV_LIVE_DVB_T_PRO)
return; return;
i2c_bit_del_bus(&vp3054_i2c->adap); i2c_del_adapter(&vp3054_i2c->adap);
kfree(vp3054_i2c); kfree(vp3054_i2c);
} }
......
...@@ -782,7 +782,7 @@ static int vino_i2c_add_bus(void) ...@@ -782,7 +782,7 @@ static int vino_i2c_add_bus(void)
static int vino_i2c_del_bus(void) static int vino_i2c_del_bus(void)
{ {
return i2c_sgi_del_bus(&vino_i2c_adapter); return i2c_del_adapter(&vino_i2c_adapter);
} }
static int i2c_camera_command(unsigned int cmd, void *arg) static int i2c_camera_command(unsigned int cmd, void *arg)
......
...@@ -849,7 +849,7 @@ zoran_register_i2c (struct zoran *zr) ...@@ -849,7 +849,7 @@ zoran_register_i2c (struct zoran *zr)
static void static void
zoran_unregister_i2c (struct zoran *zr) zoran_unregister_i2c (struct zoran *zr)
{ {
i2c_bit_del_bus((&zr->i2c_adapter)); i2c_del_adapter(&zr->i2c_adapter);
} }
/* Check a zoran_params struct for correctness, insert default params */ /* Check a zoran_params struct for correctness, insert default params */
......
...@@ -120,19 +120,19 @@ void radeon_create_i2c_busses(struct radeonfb_info *rinfo) ...@@ -120,19 +120,19 @@ void radeon_create_i2c_busses(struct radeonfb_info *rinfo)
void radeon_delete_i2c_busses(struct radeonfb_info *rinfo) void radeon_delete_i2c_busses(struct radeonfb_info *rinfo)
{ {
if (rinfo->i2c[0].rinfo) if (rinfo->i2c[0].rinfo)
i2c_bit_del_bus(&rinfo->i2c[0].adapter); i2c_del_adapter(&rinfo->i2c[0].adapter);
rinfo->i2c[0].rinfo = NULL; rinfo->i2c[0].rinfo = NULL;
if (rinfo->i2c[1].rinfo) if (rinfo->i2c[1].rinfo)
i2c_bit_del_bus(&rinfo->i2c[1].adapter); i2c_del_adapter(&rinfo->i2c[1].adapter);
rinfo->i2c[1].rinfo = NULL; rinfo->i2c[1].rinfo = NULL;
if (rinfo->i2c[2].rinfo) if (rinfo->i2c[2].rinfo)
i2c_bit_del_bus(&rinfo->i2c[2].adapter); i2c_del_adapter(&rinfo->i2c[2].adapter);
rinfo->i2c[2].rinfo = NULL; rinfo->i2c[2].rinfo = NULL;
if (rinfo->i2c[3].rinfo) if (rinfo->i2c[3].rinfo)
i2c_bit_del_bus(&rinfo->i2c[3].adapter); i2c_del_adapter(&rinfo->i2c[3].adapter);
rinfo->i2c[3].rinfo = NULL; rinfo->i2c[3].rinfo = NULL;
} }
......
...@@ -137,15 +137,15 @@ void i810_create_i2c_busses(struct i810fb_par *par) ...@@ -137,15 +137,15 @@ void i810_create_i2c_busses(struct i810fb_par *par)
void i810_delete_i2c_busses(struct i810fb_par *par) void i810_delete_i2c_busses(struct i810fb_par *par)
{ {
if (par->chan[0].par) if (par->chan[0].par)
i2c_bit_del_bus(&par->chan[0].adapter); i2c_del_adapter(&par->chan[0].adapter);
par->chan[0].par = NULL; par->chan[0].par = NULL;
if (par->chan[1].par) if (par->chan[1].par)
i2c_bit_del_bus(&par->chan[1].adapter); i2c_del_adapter(&par->chan[1].adapter);
par->chan[1].par = NULL; par->chan[1].par = NULL;
if (par->chan[2].par) if (par->chan[2].par)
i2c_bit_del_bus(&par->chan[2].adapter); i2c_del_adapter(&par->chan[2].adapter);
par->chan[2].par = NULL; par->chan[2].par = NULL;
} }
......
...@@ -188,11 +188,11 @@ void intelfb_delete_i2c_busses(struct intelfb_info *dinfo) ...@@ -188,11 +188,11 @@ void intelfb_delete_i2c_busses(struct intelfb_info *dinfo)
for (i = 0; i < MAX_OUTPUTS; i++) { for (i = 0; i < MAX_OUTPUTS; i++) {
if (dinfo->output[i].i2c_bus.dinfo) { if (dinfo->output[i].i2c_bus.dinfo) {
i2c_bit_del_bus(&dinfo->output[i].i2c_bus.adapter); i2c_del_adapter(&dinfo->output[i].i2c_bus.adapter);
dinfo->output[i].i2c_bus.dinfo = NULL; dinfo->output[i].i2c_bus.dinfo = NULL;
} }
if (dinfo->output[i].ddc_bus.dinfo) { if (dinfo->output[i].ddc_bus.dinfo) {
i2c_bit_del_bus(&dinfo->output[i].ddc_bus.adapter); i2c_del_adapter(&dinfo->output[i].ddc_bus.adapter);
dinfo->output[i].ddc_bus.dinfo = NULL; dinfo->output[i].ddc_bus.dinfo = NULL;
} }
} }
......
...@@ -124,7 +124,7 @@ static int i2c_bus_reg(struct i2c_bit_adapter* b, struct matrox_fb_info* minfo, ...@@ -124,7 +124,7 @@ static int i2c_bus_reg(struct i2c_bit_adapter* b, struct matrox_fb_info* minfo,
static void i2c_bit_bus_del(struct i2c_bit_adapter* b) { static void i2c_bit_bus_del(struct i2c_bit_adapter* b) {
if (b->initialized) { if (b->initialized) {
i2c_bit_del_bus(&b->adapter); i2c_del_adapter(&b->adapter);
b->initialized = 0; b->initialized = 0;
} }
} }
......
...@@ -147,15 +147,15 @@ void nvidia_create_i2c_busses(struct nvidia_par *par) ...@@ -147,15 +147,15 @@ void nvidia_create_i2c_busses(struct nvidia_par *par)
void nvidia_delete_i2c_busses(struct nvidia_par *par) void nvidia_delete_i2c_busses(struct nvidia_par *par)
{ {
if (par->chan[0].par) if (par->chan[0].par)
i2c_bit_del_bus(&par->chan[0].adapter); i2c_del_adapter(&par->chan[0].adapter);
par->chan[0].par = NULL; par->chan[0].par = NULL;
if (par->chan[1].par) if (par->chan[1].par)
i2c_bit_del_bus(&par->chan[1].adapter); i2c_del_adapter(&par->chan[1].adapter);
par->chan[1].par = NULL; par->chan[1].par = NULL;
if (par->chan[2].par) if (par->chan[2].par)
i2c_bit_del_bus(&par->chan[2].adapter); i2c_del_adapter(&par->chan[2].adapter);
par->chan[2].par = NULL; par->chan[2].par = NULL;
} }
......
...@@ -144,15 +144,15 @@ void riva_create_i2c_busses(struct riva_par *par) ...@@ -144,15 +144,15 @@ void riva_create_i2c_busses(struct riva_par *par)
void riva_delete_i2c_busses(struct riva_par *par) void riva_delete_i2c_busses(struct riva_par *par)
{ {
if (par->chan[0].par) if (par->chan[0].par)
i2c_bit_del_bus(&par->chan[0].adapter); i2c_del_adapter(&par->chan[0].adapter);
par->chan[0].par = NULL; par->chan[0].par = NULL;
if (par->chan[1].par) if (par->chan[1].par)
i2c_bit_del_bus(&par->chan[1].adapter); i2c_del_adapter(&par->chan[1].adapter);
par->chan[1].par = NULL; par->chan[1].par = NULL;
if (par->chan[2].par) if (par->chan[2].par)
i2c_bit_del_bus(&par->chan[2].adapter); i2c_del_adapter(&par->chan[2].adapter);
par->chan[2].par = NULL; par->chan[2].par = NULL;
} }
......
...@@ -208,7 +208,7 @@ void savagefb_delete_i2c_busses(struct fb_info *info) ...@@ -208,7 +208,7 @@ void savagefb_delete_i2c_busses(struct fb_info *info)
struct savagefb_par *par = info->par; struct savagefb_par *par = info->par;
if (par->chan.par) if (par->chan.par)
i2c_bit_del_bus(&par->chan.adapter); i2c_del_adapter(&par->chan.adapter);
par->chan.par = NULL; par->chan.par = NULL;
} }
......
/*
* PNX4008-specific tweaks for I2C IP3204 block
*
* Author: Vitaly Wool <vwool@ru.mvista.com>
*
* 2005 (c) MontaVista Software, Inc. This file is licensed under
* the terms of the GNU General Public License version 2. This program
* is licensed "as is" without any warranty of any kind, whether express
* or implied.
*/
#ifndef __ASM_ARCH_I2C_H__
#define __ASM_ARCH_I2C_H__
#include <linux/pm.h>
#include <linux/platform_device.h>
enum {
mstatus_tdi = 0x00000001,
mstatus_afi = 0x00000002,
mstatus_nai = 0x00000004,
mstatus_drmi = 0x00000008,
mstatus_active = 0x00000020,
mstatus_scl = 0x00000040,
mstatus_sda = 0x00000080,
mstatus_rff = 0x00000100,
mstatus_rfe = 0x00000200,
mstatus_tff = 0x00000400,
mstatus_tfe = 0x00000800,
};
enum {
mcntrl_tdie = 0x00000001,
mcntrl_afie = 0x00000002,
mcntrl_naie = 0x00000004,
mcntrl_drmie = 0x00000008,
mcntrl_daie = 0x00000020,
mcntrl_rffie = 0x00000040,
mcntrl_tffie = 0x00000080,
mcntrl_reset = 0x00000100,
mcntrl_cdbmode = 0x00000400,
};
enum {
rw_bit = 1 << 0,
start_bit = 1 << 8,
stop_bit = 1 << 9,
};
#define I2C_REG_RX(a) ((a)->ioaddr) /* Rx FIFO reg (RO) */
#define I2C_REG_TX(a) ((a)->ioaddr) /* Tx FIFO reg (WO) */
#define I2C_REG_STS(a) ((a)->ioaddr + 0x04) /* Status reg (RO) */
#define I2C_REG_CTL(a) ((a)->ioaddr + 0x08) /* Ctl reg */
#define I2C_REG_CKL(a) ((a)->ioaddr + 0x0c) /* Clock divider low */
#define I2C_REG_CKH(a) ((a)->ioaddr + 0x10) /* Clock divider high */
#define I2C_REG_ADR(a) ((a)->ioaddr + 0x14) /* I2C address */
#define I2C_REG_RFL(a) ((a)->ioaddr + 0x18) /* Rx FIFO level (RO) */
#define I2C_REG_TFL(a) ((a)->ioaddr + 0x1c) /* Tx FIFO level (RO) */
#define I2C_REG_RXB(a) ((a)->ioaddr + 0x20) /* Num of bytes Rx-ed (RO) */
#define I2C_REG_TXB(a) ((a)->ioaddr + 0x24) /* Num of bytes Tx-ed (RO) */
#define I2C_REG_TXS(a) ((a)->ioaddr + 0x28) /* Tx slave FIFO (RO) */
#define I2C_REG_STFL(a) ((a)->ioaddr + 0x2c) /* Tx slave FIFO level (RO) */
#define HCLK_MHZ 13
#define I2C_CHIP_NAME "PNX4008-I2C"
#endif /* __ASM_ARCH_I2C_H___ */
...@@ -26,9 +26,9 @@ ...@@ -26,9 +26,9 @@
/* --- Defines for bit-adapters --------------------------------------- */ /* --- Defines for bit-adapters --------------------------------------- */
/* /*
* This struct contains the hw-dependent functions of bit-style adapters to * This struct contains the hw-dependent functions of bit-style adapters to
* manipulate the line states, and to init any hw-specific features. This is * manipulate the line states, and to init any hw-specific features. This is
* only used if you have more than one hw-type of adapter running. * only used if you have more than one hw-type of adapter running.
*/ */
struct i2c_algo_bit_data { struct i2c_algo_bit_data {
void *data; /* private data for lowlevel routines */ void *data; /* private data for lowlevel routines */
...@@ -44,6 +44,5 @@ struct i2c_algo_bit_data { ...@@ -44,6 +44,5 @@ struct i2c_algo_bit_data {
}; };
int i2c_bit_add_bus(struct i2c_adapter *); int i2c_bit_add_bus(struct i2c_adapter *);
int i2c_bit_del_bus(struct i2c_adapter *);
#endif /* _LINUX_I2C_ALGO_BIT_H */ #endif /* _LINUX_I2C_ALGO_BIT_H */
/* ------------------------------------------------------------------------- */
/* i2c-algo-ite.h i2c driver algorithms for ITE IIC adapters */
/* ------------------------------------------------------------------------- */
/* Copyright (C) 1995-97 Simon G. Vogl
1998-99 Hans Berglund
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* ------------------------------------------------------------------------- */
/* With some changes from Kysti Mlkki <kmalkki@cc.hut.fi> and even
Frodo Looijaard <frodol@dds.nl> */
/* Modifications by MontaVista Software, 2001
Changes made to support the ITE IIC peripheral */
#ifndef I2C_ALGO_ITE_H
#define I2C_ALGO_ITE_H 1
#include <linux/types.h>
/* Example of a sequential read request:
struct i2c_iic_msg s_msg;
s_msg.addr=device_address;
s_msg.len=length;
s_msg.buf=buffer;
s_msg.waddr=word_address;
ioctl(file,I2C_SREAD, &s_msg);
*/
#define I2C_SREAD 0x780 /* SREAD ioctl command */
struct i2c_iic_msg {
__u16 addr; /* device address */
__u16 waddr; /* word address */
short len; /* msg length */
char *buf; /* pointer to msg data */
};
#ifdef __KERNEL__
struct i2c_adapter;
struct i2c_algo_iic_data {
void *data; /* private data for lolevel routines */
void (*setiic) (void *data, int ctl, int val);
int (*getiic) (void *data, int ctl);
int (*getown) (void *data);
int (*getclock) (void *data);
void (*waitforpin) (void);
/* local settings */
int udelay;
int mdelay;
int timeout;
};
int i2c_iic_add_bus(struct i2c_adapter *);
int i2c_iic_del_bus(struct i2c_adapter *);
#endif /* __KERNEL__ */
#endif /* I2C_ALGO_ITE_H */
...@@ -10,6 +10,5 @@ struct i2c_algo_pca_data { ...@@ -10,6 +10,5 @@ struct i2c_algo_pca_data {
}; };
int i2c_pca_add_bus(struct i2c_adapter *); int i2c_pca_add_bus(struct i2c_adapter *);
int i2c_pca_del_bus(struct i2c_adapter *);
#endif /* _LINUX_I2C_ALGO_PCA_H */ #endif /* _LINUX_I2C_ALGO_PCA_H */
...@@ -31,7 +31,7 @@ struct i2c_algo_pcf_data { ...@@ -31,7 +31,7 @@ struct i2c_algo_pcf_data {
int (*getpcf) (void *data, int ctl); int (*getpcf) (void *data, int ctl);
int (*getown) (void *data); int (*getown) (void *data);
int (*getclock) (void *data); int (*getclock) (void *data);
void (*waitforpin) (void); void (*waitforpin) (void);
/* local settings */ /* local settings */
int udelay; int udelay;
...@@ -39,6 +39,5 @@ struct i2c_algo_pcf_data { ...@@ -39,6 +39,5 @@ struct i2c_algo_pcf_data {
}; };
int i2c_pcf_add_bus(struct i2c_adapter *); int i2c_pcf_add_bus(struct i2c_adapter *);
int i2c_pcf_del_bus(struct i2c_adapter *);
#endif /* _LINUX_I2C_ALGO_PCF_H */ #endif /* _LINUX_I2C_ALGO_PCF_H */
...@@ -22,6 +22,5 @@ struct i2c_algo_sgi_data { ...@@ -22,6 +22,5 @@ struct i2c_algo_sgi_data {
}; };
int i2c_sgi_add_bus(struct i2c_adapter *); int i2c_sgi_add_bus(struct i2c_adapter *);
int i2c_sgi_del_bus(struct i2c_adapter *);
#endif /* I2C_ALGO_SGI_H */ #endif /* I2C_ALGO_SGI_H */
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
/* */ /* */
/* i2c-id.h - identifier values for i2c drivers and adapters */ /* i2c-id.h - identifier values for i2c drivers and adapters */
/* */ /* */
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
/* Copyright (C) 1995-1999 Simon G. Vogl /* Copyright (C) 1995-1999 Simon G. Vogl
...@@ -40,10 +40,10 @@ ...@@ -40,10 +40,10 @@
#define I2C_DRIVERID_SAA7120 11 /* video encoder */ #define I2C_DRIVERID_SAA7120 11 /* video encoder */
#define I2C_DRIVERID_SAA7121 12 /* video encoder */ #define I2C_DRIVERID_SAA7121 12 /* video encoder */
#define I2C_DRIVERID_SAA7185B 13 /* video encoder */ #define I2C_DRIVERID_SAA7185B 13 /* video encoder */
#define I2C_DRIVERID_CH7003 14 /* digital pc to tv encoder */ #define I2C_DRIVERID_CH7003 14 /* digital pc to tv encoder */
#define I2C_DRIVERID_PCF8574A 15 /* i2c expander - 8 bit in/out */ #define I2C_DRIVERID_PCF8574A 15 /* i2c expander - 8 bit in/out */
#define I2C_DRIVERID_PCF8582C 16 /* eeprom */ #define I2C_DRIVERID_PCF8582C 16 /* eeprom */
#define I2C_DRIVERID_AT24Cxx 17 /* eeprom 1/2/4/8/16 K */ #define I2C_DRIVERID_AT24Cxx 17 /* eeprom 1/2/4/8/16 K */
#define I2C_DRIVERID_TEA6300 18 /* audio mixer */ #define I2C_DRIVERID_TEA6300 18 /* audio mixer */
#define I2C_DRIVERID_BT829 19 /* pc to tv encoder */ #define I2C_DRIVERID_BT829 19 /* pc to tv encoder */
#define I2C_DRIVERID_TDA9850 20 /* audio mixer */ #define I2C_DRIVERID_TDA9850 20 /* audio mixer */
...@@ -82,9 +82,8 @@ ...@@ -82,9 +82,8 @@
#define I2C_DRIVERID_STM41T00 52 /* real time clock */ #define I2C_DRIVERID_STM41T00 52 /* real time clock */
#define I2C_DRIVERID_UDA1342 53 /* UDA1342 audio codec */ #define I2C_DRIVERID_UDA1342 53 /* UDA1342 audio codec */
#define I2C_DRIVERID_ADV7170 54 /* video encoder */ #define I2C_DRIVERID_ADV7170 54 /* video encoder */
#define I2C_DRIVERID_RADEON 55 /* I2C bus on Radeon boards */
#define I2C_DRIVERID_MAX1617 56 /* temp sensor */ #define I2C_DRIVERID_MAX1617 56 /* temp sensor */
#define I2C_DRIVERID_SAA7191 57 /* video encoder */ #define I2C_DRIVERID_SAA7191 57 /* video decoder */
#define I2C_DRIVERID_INDYCAM 58 /* SGI IndyCam */ #define I2C_DRIVERID_INDYCAM 58 /* SGI IndyCam */
#define I2C_DRIVERID_BT832 59 /* CMOS camera video processor */ #define I2C_DRIVERID_BT832 59 /* CMOS camera video processor */
#define I2C_DRIVERID_TDA9887 60 /* TDA988x IF-PLL demodulator */ #define I2C_DRIVERID_TDA9887 60 /* TDA988x IF-PLL demodulator */
...@@ -132,7 +131,6 @@ ...@@ -132,7 +131,6 @@
#define I2C_DRIVERID_ADM1021 1008 #define I2C_DRIVERID_ADM1021 1008
#define I2C_DRIVERID_ADM9240 1009 #define I2C_DRIVERID_ADM9240 1009
#define I2C_DRIVERID_LTC1710 1010 #define I2C_DRIVERID_LTC1710 1010
#define I2C_DRIVERID_ICSPLL 1012
#define I2C_DRIVERID_BT869 1013 #define I2C_DRIVERID_BT869 1013
#define I2C_DRIVERID_MAXILIFE 1014 #define I2C_DRIVERID_MAXILIFE 1014
#define I2C_DRIVERID_MATORB 1015 #define I2C_DRIVERID_MATORB 1015
...@@ -165,7 +163,7 @@ ...@@ -165,7 +163,7 @@
* ---- Adapter types ---------------------------------------------------- * ---- Adapter types ----------------------------------------------------
*/ */
/* --- Bit algorithm adapters */ /* --- Bit algorithm adapters */
#define I2C_HW_B_LP 0x010000 /* Parallel port Philips style */ #define I2C_HW_B_LP 0x010000 /* Parallel port Philips style */
#define I2C_HW_B_SER 0x010002 /* Serial line interface */ #define I2C_HW_B_SER 0x010002 /* Serial line interface */
#define I2C_HW_B_BT848 0x010005 /* BT848 video boards */ #define I2C_HW_B_BT848 0x010005 /* BT848 video boards */
...@@ -213,9 +211,6 @@ ...@@ -213,9 +211,6 @@
/* --- MPC8xx PowerPC adapters */ /* --- MPC8xx PowerPC adapters */
#define I2C_HW_MPC8XX_EPON 0x110000 /* Eponymous MPC8xx I2C adapter */ #define I2C_HW_MPC8XX_EPON 0x110000 /* Eponymous MPC8xx I2C adapter */
/* --- ITE based algorithms */
#define I2C_HW_I_IIC 0x080000 /* controller on the ITE */
/* --- PowerPC on-chip adapters */ /* --- PowerPC on-chip adapters */
#define I2C_HW_OCP 0x120000 /* IBM on-chip I2C adapter */ #define I2C_HW_OCP 0x120000 /* IBM on-chip I2C adapter */
......
/*
* Header file for I2C support on PNX010x/4008.
*
* Author: Dennis Kovalev <dkovalev@ru.mvista.com>
*
* 2004-2006 (c) MontaVista Software, Inc. This file is licensed under
* the terms of the GNU General Public License version 2. This program
* is licensed "as is" without any warranty of any kind, whether express
* or implied.
*/
#ifndef __I2C_PNX_H__
#define __I2C_PNX_H__
#include <asm/arch/i2c.h>
struct i2c_pnx_mif {
int ret; /* Return value */
int mode; /* Interface mode */
struct completion complete; /* I/O completion */
struct timer_list timer; /* Timeout */
char * buf; /* Data buffer */
int len; /* Length of data buffer */
};
struct i2c_pnx_algo_data {
u32 base;
u32 ioaddr;
int irq;
struct i2c_pnx_mif mif;
int last;
};
struct i2c_pnx_data {
int (*suspend) (struct platform_device *pdev, pm_message_t state);
int (*resume) (struct platform_device *pdev);
u32 (*calculate_input_freq) (struct platform_device *pdev);
int (*set_clock_run) (struct platform_device *pdev);
int (*set_clock_stop) (struct platform_device *pdev);
struct i2c_adapter *adapter;
};
#endif /* __I2C_PNX_H__ */
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
/* */ /* */
/* i2c.h - definitions for the i2c-bus interface */ /* i2c.h - definitions for the i2c-bus interface */
/* */ /* */
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
/* Copyright (C) 1995-2000 Simon G. Vogl /* Copyright (C) 1995-2000 Simon G. Vogl
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#define _LINUX_I2C_H #define _LINUX_I2C_H
#include <linux/types.h> #include <linux/types.h>
#ifdef __KERNEL__ #ifdef __KERNEL__
#include <linux/module.h> #include <linux/module.h>
#include <linux/i2c-id.h> #include <linux/i2c-id.h>
#include <linux/mod_devicetable.h> #include <linux/mod_devicetable.h>
...@@ -53,8 +53,8 @@ union i2c_smbus_data; ...@@ -53,8 +53,8 @@ union i2c_smbus_data;
/* /*
* The master routines are the ones normally used to transmit data to devices * The master routines are the ones normally used to transmit data to devices
* on a bus (or read from them). Apart from two basic transfer functions to * on a bus (or read from them). Apart from two basic transfer functions to
* transmit one message at a time, a more complex version can be used to * transmit one message at a time, a more complex version can be used to
* transmit an arbitrary number of messages without interruption. * transmit an arbitrary number of messages without interruption.
*/ */
extern int i2c_master_send(struct i2c_client *,const char* ,int); extern int i2c_master_send(struct i2c_client *,const char* ,int);
...@@ -67,10 +67,10 @@ extern int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) ...@@ -67,10 +67,10 @@ extern int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
/* This is the very generalized SMBus access routine. You probably do not /* This is the very generalized SMBus access routine. You probably do not
want to use this, though; one of the functions below may be much easier, want to use this, though; one of the functions below may be much easier,
and probably just as fast. and probably just as fast.
Note that we use i2c_adapter here, because you do not need a specific Note that we use i2c_adapter here, because you do not need a specific
smbus adapter to call this function. */ smbus adapter to call this function. */
extern s32 i2c_smbus_xfer (struct i2c_adapter * adapter, u16 addr, extern s32 i2c_smbus_xfer (struct i2c_adapter * adapter, u16 addr,
unsigned short flags, unsigned short flags,
char read_write, u8 command, int size, char read_write, u8 command, int size,
union i2c_smbus_data * data); union i2c_smbus_data * data);
...@@ -112,14 +112,14 @@ struct i2c_driver { ...@@ -112,14 +112,14 @@ struct i2c_driver {
/* Notifies the driver that a new bus has appeared. This routine /* Notifies the driver that a new bus has appeared. This routine
* can be used by the driver to test if the bus meets its conditions * can be used by the driver to test if the bus meets its conditions
* & seek for the presence of the chip(s) it supports. If found, it * & seek for the presence of the chip(s) it supports. If found, it
* registers the client(s) that are on the bus to the i2c admin. via * registers the client(s) that are on the bus to the i2c admin. via
* i2c_attach_client. * i2c_attach_client.
*/ */
int (*attach_adapter)(struct i2c_adapter *); int (*attach_adapter)(struct i2c_adapter *);
int (*detach_adapter)(struct i2c_adapter *); int (*detach_adapter)(struct i2c_adapter *);
/* tells the driver that a client is about to be deleted & gives it /* tells the driver that a client is about to be deleted & gives it
* the chance to remove its private data. Also, if the client struct * the chance to remove its private data. Also, if the client struct
* has been dynamically allocated by the driver in the function above, * has been dynamically allocated by the driver in the function above,
* it must be freed here. * it must be freed here.
...@@ -139,13 +139,13 @@ struct i2c_driver { ...@@ -139,13 +139,13 @@ struct i2c_driver {
#define I2C_NAME_SIZE 50 #define I2C_NAME_SIZE 50
/* /*
* i2c_client identifies a single device (i.e. chip) that is connected to an * i2c_client identifies a single device (i.e. chip) that is connected to an
* i2c bus. The behaviour is defined by the routines of the driver. This * i2c bus. The behaviour is defined by the routines of the driver. This
* function is mainly used for lookup & other admin. functions. * function is mainly used for lookup & other admin. functions.
*/ */
struct i2c_client { struct i2c_client {
unsigned int flags; /* div., see below */ unsigned int flags; /* div., see below */
unsigned short addr; /* chip address - NOTE: 7bit */ unsigned short addr; /* chip address - NOTE: 7bit */
/* addresses are stored in the */ /* addresses are stored in the */
/* _LOWER_ 7 bits */ /* _LOWER_ 7 bits */
struct i2c_adapter *adapter; /* the adapter we sit on */ struct i2c_adapter *adapter; /* the adapter we sit on */
...@@ -182,14 +182,14 @@ static inline void i2c_set_clientdata (struct i2c_client *dev, void *data) ...@@ -182,14 +182,14 @@ static inline void i2c_set_clientdata (struct i2c_client *dev, void *data)
*/ */
struct i2c_algorithm { struct i2c_algorithm {
/* If an adapter algorithm can't do I2C-level access, set master_xfer /* If an adapter algorithm can't do I2C-level access, set master_xfer
to NULL. If an adapter algorithm can do SMBus access, set to NULL. If an adapter algorithm can do SMBus access, set
smbus_xfer. If set to NULL, the SMBus protocol is simulated smbus_xfer. If set to NULL, the SMBus protocol is simulated
using common I2C messages */ using common I2C messages */
/* master_xfer should return the number of messages successfully /* master_xfer should return the number of messages successfully
processed, or a negative value on error */ processed, or a negative value on error */
int (*master_xfer)(struct i2c_adapter *adap,struct i2c_msg *msgs, int (*master_xfer)(struct i2c_adapter *adap,struct i2c_msg *msgs,
int num); int num);
int (*smbus_xfer) (struct i2c_adapter *adap, u16 addr, int (*smbus_xfer) (struct i2c_adapter *adap, u16 addr,
unsigned short flags, char read_write, unsigned short flags, char read_write,
u8 command, int size, union i2c_smbus_data * data); u8 command, int size, union i2c_smbus_data * data);
...@@ -216,6 +216,7 @@ struct i2c_adapter { ...@@ -216,6 +216,7 @@ struct i2c_adapter {
int (*client_unregister)(struct i2c_client *); int (*client_unregister)(struct i2c_client *);
/* data fields that are valid for all devices */ /* data fields that are valid for all devices */
u8 level; /* nesting level for lockdep */
struct mutex bus_lock; struct mutex bus_lock;
struct mutex clist_lock; struct mutex clist_lock;
...@@ -316,7 +317,7 @@ extern int i2c_check_addr (struct i2c_adapter *adapter, int addr); ...@@ -316,7 +317,7 @@ extern int i2c_check_addr (struct i2c_adapter *adapter, int addr);
* It will only call found_proc if some client is connected at the * It will only call found_proc if some client is connected at the
* specific address (unless a 'force' matched); * specific address (unless a 'force' matched);
*/ */
extern int i2c_probe(struct i2c_adapter *adapter, extern int i2c_probe(struct i2c_adapter *adapter,
struct i2c_client_address_data *address_data, struct i2c_client_address_data *address_data,
int (*found_proc) (struct i2c_adapter *, int, int)); int (*found_proc) (struct i2c_adapter *, int, int));
...@@ -352,15 +353,15 @@ static inline int i2c_adapter_id(struct i2c_adapter *adap) ...@@ -352,15 +353,15 @@ static inline int i2c_adapter_id(struct i2c_adapter *adap)
*/ */
struct i2c_msg { struct i2c_msg {
__u16 addr; /* slave address */ __u16 addr; /* slave address */
__u16 flags; __u16 flags;
#define I2C_M_TEN 0x10 /* we have a ten bit chip address */ #define I2C_M_TEN 0x10 /* we have a ten bit chip address */
#define I2C_M_RD 0x01 #define I2C_M_RD 0x01
#define I2C_M_NOSTART 0x4000 #define I2C_M_NOSTART 0x4000
#define I2C_M_REV_DIR_ADDR 0x2000 #define I2C_M_REV_DIR_ADDR 0x2000
#define I2C_M_IGNORE_NAK 0x1000 #define I2C_M_IGNORE_NAK 0x1000
#define I2C_M_NO_RD_ACK 0x0800 #define I2C_M_NO_RD_ACK 0x0800
__u16 len; /* msg length */ __u16 len; /* msg length */
__u8 *buf; /* pointer to msg data */ __u8 *buf; /* pointer to msg data */
}; };
/* To determine what functionality is present */ /* To determine what functionality is present */
...@@ -370,16 +371,16 @@ struct i2c_msg { ...@@ -370,16 +371,16 @@ struct i2c_msg {
#define I2C_FUNC_PROTOCOL_MANGLING 0x00000004 /* I2C_M_{REV_DIR_ADDR,NOSTART,..} */ #define I2C_FUNC_PROTOCOL_MANGLING 0x00000004 /* I2C_M_{REV_DIR_ADDR,NOSTART,..} */
#define I2C_FUNC_SMBUS_HWPEC_CALC 0x00000008 /* SMBus 2.0 */ #define I2C_FUNC_SMBUS_HWPEC_CALC 0x00000008 /* SMBus 2.0 */
#define I2C_FUNC_SMBUS_BLOCK_PROC_CALL 0x00008000 /* SMBus 2.0 */ #define I2C_FUNC_SMBUS_BLOCK_PROC_CALL 0x00008000 /* SMBus 2.0 */
#define I2C_FUNC_SMBUS_QUICK 0x00010000 #define I2C_FUNC_SMBUS_QUICK 0x00010000
#define I2C_FUNC_SMBUS_READ_BYTE 0x00020000 #define I2C_FUNC_SMBUS_READ_BYTE 0x00020000
#define I2C_FUNC_SMBUS_WRITE_BYTE 0x00040000 #define I2C_FUNC_SMBUS_WRITE_BYTE 0x00040000
#define I2C_FUNC_SMBUS_READ_BYTE_DATA 0x00080000 #define I2C_FUNC_SMBUS_READ_BYTE_DATA 0x00080000
#define I2C_FUNC_SMBUS_WRITE_BYTE_DATA 0x00100000 #define I2C_FUNC_SMBUS_WRITE_BYTE_DATA 0x00100000
#define I2C_FUNC_SMBUS_READ_WORD_DATA 0x00200000 #define I2C_FUNC_SMBUS_READ_WORD_DATA 0x00200000
#define I2C_FUNC_SMBUS_WRITE_WORD_DATA 0x00400000 #define I2C_FUNC_SMBUS_WRITE_WORD_DATA 0x00400000
#define I2C_FUNC_SMBUS_PROC_CALL 0x00800000 #define I2C_FUNC_SMBUS_PROC_CALL 0x00800000
#define I2C_FUNC_SMBUS_READ_BLOCK_DATA 0x01000000 #define I2C_FUNC_SMBUS_READ_BLOCK_DATA 0x01000000
#define I2C_FUNC_SMBUS_WRITE_BLOCK_DATA 0x02000000 #define I2C_FUNC_SMBUS_WRITE_BLOCK_DATA 0x02000000
#define I2C_FUNC_SMBUS_READ_I2C_BLOCK 0x04000000 /* I2C-like block xfer */ #define I2C_FUNC_SMBUS_READ_I2C_BLOCK 0x04000000 /* I2C-like block xfer */
#define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK 0x08000000 /* w/ 1-byte reg. addr. */ #define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK 0x08000000 /* w/ 1-byte reg. addr. */
#define I2C_FUNC_SMBUS_READ_I2C_BLOCK_2 0x10000000 /* I2C-like block xfer */ #define I2C_FUNC_SMBUS_READ_I2C_BLOCK_2 0x10000000 /* I2C-like block xfer */
...@@ -406,10 +407,10 @@ struct i2c_msg { ...@@ -406,10 +407,10 @@ struct i2c_msg {
I2C_FUNC_SMBUS_WRITE_BLOCK_DATA | \ I2C_FUNC_SMBUS_WRITE_BLOCK_DATA | \
I2C_FUNC_SMBUS_I2C_BLOCK) I2C_FUNC_SMBUS_I2C_BLOCK)
/* /*
* Data for SMBus Messages * Data for SMBus Messages
*/ */
#define I2C_SMBUS_BLOCK_MAX 32 /* As specified in SMBus standard */ #define I2C_SMBUS_BLOCK_MAX 32 /* As specified in SMBus standard */
union i2c_smbus_data { union i2c_smbus_data {
__u8 byte; __u8 byte;
__u16 word; __u16 word;
...@@ -421,11 +422,11 @@ union i2c_smbus_data { ...@@ -421,11 +422,11 @@ union i2c_smbus_data {
#define I2C_SMBUS_READ 1 #define I2C_SMBUS_READ 1
#define I2C_SMBUS_WRITE 0 #define I2C_SMBUS_WRITE 0
/* SMBus transaction types (size parameter in the above functions) /* SMBus transaction types (size parameter in the above functions)
Note: these no longer correspond to the (arbitrary) PIIX4 internal codes! */ Note: these no longer correspond to the (arbitrary) PIIX4 internal codes! */
#define I2C_SMBUS_QUICK 0 #define I2C_SMBUS_QUICK 0
#define I2C_SMBUS_BYTE 1 #define I2C_SMBUS_BYTE 1
#define I2C_SMBUS_BYTE_DATA 2 #define I2C_SMBUS_BYTE_DATA 2
#define I2C_SMBUS_WORD_DATA 3 #define I2C_SMBUS_WORD_DATA 3
#define I2C_SMBUS_PROC_CALL 4 #define I2C_SMBUS_PROC_CALL 4
#define I2C_SMBUS_BLOCK_DATA 5 #define I2C_SMBUS_BLOCK_DATA 5
...@@ -434,15 +435,15 @@ union i2c_smbus_data { ...@@ -434,15 +435,15 @@ union i2c_smbus_data {
/* ----- commands for the ioctl like i2c_command call: /* ----- commands for the ioctl like i2c_command call:
* note that additional calls are defined in the algorithm and hw * note that additional calls are defined in the algorithm and hw
* dependent layers - these can be listed here, or see the * dependent layers - these can be listed here, or see the
* corresponding header files. * corresponding header files.
*/ */
/* -> bit-adapter specific ioctls */ /* -> bit-adapter specific ioctls */
#define I2C_RETRIES 0x0701 /* number of times a device address */ #define I2C_RETRIES 0x0701 /* number of times a device address */
/* should be polled when not */ /* should be polled when not */
/* acknowledging */ /* acknowledging */
#define I2C_TIMEOUT 0x0702 /* set timeout - call with int */ #define I2C_TIMEOUT 0x0702 /* set timeout - call with int */
/* this is for i2c-dev.c */ /* this is for i2c-dev.c */
......
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