Skip to content

Commit

Permalink
Merge branch 'i2c/for-3.17' of git://git.kernel.org/pub/scm/linux/ker…
Browse files Browse the repository at this point in the history
…nel/git/wsa/linux

Pull i2c updates from Wolfram Sang:
 "Highlights:

   - class based instantiation finally dropped for most embedded drivers
     bringing boot up performance gains
   - removed two drivers (one outdated, one a duplicate)
   - ACPI has now operation region support (thanks to Lan Tianyu)
   - the i2c-stub driver got overhauled and gained new features to
     become more useful when writing i2c client drivers (thanks to
     Guenter Roeck and Jean Delvare)

  The rest is driver bugfixes, added bindings/ids, cleanups..."

* 'i2c/for-3.17' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (43 commits)
  i2c: mpc: delete unneeded test before of_node_put
  i2c: rk3x: fix interrupt handling issue
  i2c: imx: Fix format warning for dev_dbg
  i2c: qup: disable clks and return instead of just returning error
  i2c: exynos5: always enable HSI2C
  i2c: designware: add new bindings
  i2c: gpio: Drop dead code in i2c_gpio_remove
  i2c: pca954x: put the mux to disconnected state after resume
  i2c: st: Update i2c timings
  drivers/i2c/busses: use correct type for dma_map/unmap
  i2c: i2c-st: Use %pa to print 'resource_size_t' type
  i2c: s3c2410: resume the I2C controller earlier
  i2c: stub: Avoid an array overrun on I2C block transfers
  i2c: i801: Add device ID for Intel Wildcat Point PCH
  i2c: i801: Fix the alignment of the device table
  i2c: stub: Add support for banked register ranges
  i2c: stub: Remember the number of emulated chips
  i2c: stub: Add support for SMBus block commands
  i2c: efm32: correct namespacing of location property
  i2c: exynos5: remove extra line and fix an assignment
  ...
  • Loading branch information
torvalds committed Aug 9, 2014
2 parents 7b9828d + ebba48b commit f7dbaef
Show file tree
Hide file tree
Showing 43 changed files with 853 additions and 942 deletions.
4 changes: 2 additions & 2 deletions Documentation/devicetree/bindings/i2c/i2c-efm32.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Required properties :
Recommended properties :

- clock-frequency : maximal I2C bus clock frequency in Hz.
- efm32,location : Decides the location of the USART I/O pins.
- energymicro,location : Decides the location of the USART I/O pins.
Allowed range : [0 .. 6]

Example:
Expand All @@ -23,7 +23,7 @@ Example:
clocks = <&cmu clk_HFPERCLKI2C0>;
clock-frequency = <100000>;
status = "ok";
efm32,location = <3>;
energymicro,location = <3>;

eeprom@50 {
compatible = "microchip,24c02";
Expand Down
1 change: 1 addition & 0 deletions Documentation/i2c/busses/i2c-i801
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Supported adapters:
* Intel Avoton (SOC)
* Intel Wellsburg (PCH)
* Intel Coleto Creek (PCH)
* Intel Wildcat Point (PCH)
* Intel Wildcat Point-LP (PCH)
* Intel BayTrail (SOC)
Datasheets: Publicly available at the Intel website
Expand Down
23 changes: 17 additions & 6 deletions Documentation/i2c/i2c-stub
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ MODULE: i2c-stub

DESCRIPTION:

This module is a very simple fake I2C/SMBus driver. It implements five
This module is a very simple fake I2C/SMBus driver. It implements six
types of SMBus commands: write quick, (r/w) byte, (r/w) byte data, (r/w)
word data, and (r/w) I2C block data.
word data, (r/w) I2C block data, and (r/w) SMBus block data.

You need to provide chip addresses as a module parameter when loading this
driver, which will then only react to SMBus commands to these addresses.
Expand All @@ -19,6 +19,14 @@ A pointer register with auto-increment is implemented for all byte
operations. This allows for continuous byte reads like those supported by
EEPROMs, among others.

SMBus block command support is disabled by default, and must be enabled
explicitly by setting the respective bits (0x03000000) in the functionality
module parameter.

SMBus block commands must be written to configure an SMBus command for
SMBus block operations. Writes can be partial. Block read commands always
return the number of bytes selected with the largest write so far.

The typical use-case is like this:
1. load this module
2. use i2cset (from the i2c-tools project) to pre-load some data
Expand All @@ -39,15 +47,18 @@ unsigned long functionality:
value 0x1f0000 would only enable the quick, byte and byte data
commands.

u8 bank_reg[10]
u8 bank_mask[10]
u8 bank_start[10]
u8 bank_end[10]:
Optional bank settings. They tell which bits in which register
select the active bank, as well as the range of banked registers.

CAVEATS:

If your target driver polls some byte or word waiting for it to change, the
stub could lock it up. Use i2cset to unlock it.

If the hardware for your driver has banked registers (e.g. Winbond sensors
chips) this module will not work well - although it could be extended to
support that pretty easily.

If you spam it hard enough, printk can be lossy. This module really wants
something like relayfs.

18 changes: 17 additions & 1 deletion drivers/i2c/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
# I2C subsystem configuration
#

menuconfig I2C
menu "I2C support"

config I2C
tristate "I2C support"
select RT_MUTEXES
---help---
Expand All @@ -21,6 +23,18 @@ menuconfig I2C
This I2C support can also be built as a module. If so, the module
will be called i2c-core.

config I2C_ACPI
bool "I2C ACPI support"
select I2C
depends on ACPI
default y
help
Say Y here if you want to enable ACPI I2C support. This includes support
for automatic enumeration of I2C slave devices and support for ACPI I2C
Operation Regions. Operation Regions allow firmware (BIOS) code to
access I2C slave devices, such as smart batteries through an I2C host
controller driver.

if I2C

config I2C_BOARDINFO
Expand Down Expand Up @@ -124,3 +138,5 @@ config I2C_DEBUG_BUS
on.

endif # I2C

endmenu
5 changes: 4 additions & 1 deletion drivers/i2c/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
# Makefile for the i2c core.
#

i2ccore-y := i2c-core.o
i2ccore-$(CONFIG_I2C_ACPI) += i2c-acpi.o

obj-$(CONFIG_I2C_BOARDINFO) += i2c-boardinfo.o
obj-$(CONFIG_I2C) += i2c-core.o
obj-$(CONFIG_I2C) += i2ccore.o
obj-$(CONFIG_I2C_SMBUS) += i2c-smbus.o
obj-$(CONFIG_I2C_CHARDEV) += i2c-dev.o
obj-$(CONFIG_I2C_MUX) += i2c-mux.o
Expand Down
46 changes: 3 additions & 43 deletions drivers/i2c/busses/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ config I2C_I801
Avoton (SOC)
Wellsburg (PCH)
Coleto Creek (PCH)
Wildcat Point (PCH)
Wildcat Point-LP (PCH)
BayTrail (SOC)

Expand Down Expand Up @@ -465,9 +466,9 @@ config I2C_EG20T
config I2C_EXYNOS5
tristate "Exynos5 high-speed I2C driver"
depends on ARCH_EXYNOS5 && OF
default y
help
Say Y here to include support for high-speed I2C controller in the
Exynos5 based Samsung SoCs.
High-speed I2C controller on Exynos5 based Samsung SoCs.

config I2C_GPIO
tristate "GPIO-based bitbanging I2C"
Expand Down Expand Up @@ -700,16 +701,6 @@ config I2C_S3C2410
Say Y here to include support for I2C controller in the
Samsung SoCs.

config I2C_S6000
tristate "S6000 I2C support"
depends on XTENSA_VARIANT_S6000
help
This driver supports the on chip I2C device on the
S6000 xtensa processor family.

To compile this driver as a module, choose M here. The module
will be called i2c-s6000.

config I2C_SH7760
tristate "Renesas SH7760 I2C Controller"
depends on CPU_SUBTYPE_SH7760
Expand Down Expand Up @@ -1018,37 +1009,6 @@ config I2C_CROS_EC_TUNNEL
connected there. This will work whatever the interface used to
talk to the EC (SPI, I2C or LPC).

config SCx200_I2C
tristate "NatSemi SCx200 I2C using GPIO pins (DEPRECATED)"
depends on SCx200_GPIO
select I2C_ALGOBIT
help
Enable the use of two GPIO pins of a SCx200 processor as an I2C bus.

If you don't know what to do here, say N.

This support is also available as a module. If so, the module
will be called scx200_i2c.

This driver is deprecated and will be dropped soon. Use i2c-gpio
(or scx200_acb) instead.

config SCx200_I2C_SCL
int "GPIO pin used for SCL"
depends on SCx200_I2C
default "12"
help
Enter the GPIO pin number used for the SCL signal. This value can
also be specified with a module parameter.

config SCx200_I2C_SDA
int "GPIO pin used for SDA"
depends on SCx200_I2C
default "13"
help
Enter the GPIO pin number used for the SSA signal. This value can
also be specified with a module parameter.

config SCx200_ACB
tristate "Geode ACCESS.bus support"
depends on X86_32 && PCI
Expand Down
2 changes: 0 additions & 2 deletions drivers/i2c/busses/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ obj-$(CONFIG_I2C_QUP) += i2c-qup.o
obj-$(CONFIG_I2C_RIIC) += i2c-riic.o
obj-$(CONFIG_I2C_RK3X) += i2c-rk3x.o
obj-$(CONFIG_I2C_S3C2410) += i2c-s3c2410.o
obj-$(CONFIG_I2C_S6000) += i2c-s6000.o
obj-$(CONFIG_I2C_SH7760) += i2c-sh7760.o
obj-$(CONFIG_I2C_SH_MOBILE) += i2c-sh_mobile.o
obj-$(CONFIG_I2C_SIMTEC) += i2c-simtec.o
Expand Down Expand Up @@ -101,6 +100,5 @@ obj-$(CONFIG_I2C_ELEKTOR) += i2c-elektor.o
obj-$(CONFIG_I2C_PCA_ISA) += i2c-pca-isa.o
obj-$(CONFIG_I2C_SIBYTE) += i2c-sibyte.o
obj-$(CONFIG_SCx200_ACB) += scx200_acb.o
obj-$(CONFIG_SCx200_I2C) += scx200_i2c.o

ccflags-$(CONFIG_I2C_DEBUG_BUS) := -DDEBUG
6 changes: 3 additions & 3 deletions drivers/i2c/busses/i2c-at91.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ static void at91_twi_write_data_dma_callback(void *data)
struct at91_twi_dev *dev = (struct at91_twi_dev *)data;

dma_unmap_single(dev->dev, sg_dma_address(&dev->dma.sg),
dev->buf_len, DMA_MEM_TO_DEV);
dev->buf_len, DMA_TO_DEVICE);

at91_twi_write(dev, AT91_TWI_CR, AT91_TWI_STOP);
}
Expand Down Expand Up @@ -289,7 +289,7 @@ static void at91_twi_read_data_dma_callback(void *data)
struct at91_twi_dev *dev = (struct at91_twi_dev *)data;

dma_unmap_single(dev->dev, sg_dma_address(&dev->dma.sg),
dev->buf_len, DMA_DEV_TO_MEM);
dev->buf_len, DMA_FROM_DEVICE);

/* The last two bytes have to be read without using dma */
dev->buf += dev->buf_len - 2;
Expand Down Expand Up @@ -768,7 +768,7 @@ static int at91_twi_probe(struct platform_device *pdev)
snprintf(dev->adapter.name, sizeof(dev->adapter.name), "AT91");
i2c_set_adapdata(&dev->adapter, dev);
dev->adapter.owner = THIS_MODULE;
dev->adapter.class = I2C_CLASS_HWMON | I2C_CLASS_DEPRECATED;
dev->adapter.class = I2C_CLASS_DEPRECATED;
dev->adapter.algo = &at91_twi_algorithm;
dev->adapter.dev.parent = dev->dev;
dev->adapter.nr = pdev->id;
Expand Down
2 changes: 1 addition & 1 deletion drivers/i2c/busses/i2c-bcm2835.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ static int bcm2835_i2c_probe(struct platform_device *pdev)
adap = &i2c_dev->adapter;
i2c_set_adapdata(adap, i2c_dev);
adap->owner = THIS_MODULE;
adap->class = I2C_CLASS_HWMON | I2C_CLASS_DEPRECATED;
adap->class = I2C_CLASS_DEPRECATED;
strlcpy(adap->name, "bcm2835 I2C adapter", sizeof(adap->name));
adap->algo = &bcm2835_i2c_algo;
adap->dev.parent = &pdev->dev;
Expand Down
2 changes: 1 addition & 1 deletion drivers/i2c/busses/i2c-bfin-twi.c
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ static int i2c_bfin_twi_probe(struct platform_device *pdev)
strlcpy(p_adap->name, pdev->name, sizeof(p_adap->name));
p_adap->algo = &bfin_twi_algorithm;
p_adap->algo_data = iface;
p_adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD | I2C_CLASS_DEPRECATED;
p_adap->class = I2C_CLASS_DEPRECATED;
p_adap->dev.parent = &pdev->dev;
p_adap->timeout = 5 * HZ;
p_adap->retries = 3;
Expand Down
2 changes: 1 addition & 1 deletion drivers/i2c/busses/i2c-davinci.c
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ static int davinci_i2c_probe(struct platform_device *pdev)
adap = &dev->adapter;
i2c_set_adapdata(adap, dev);
adap->owner = THIS_MODULE;
adap->class = I2C_CLASS_HWMON | I2C_CLASS_DEPRECATED;
adap->class = I2C_CLASS_DEPRECATED;
strlcpy(adap->name, "DaVinci I2C adapter", sizeof(adap->name));
adap->algo = &i2c_davinci_algo;
adap->dev.parent = &pdev->dev;
Expand Down
9 changes: 9 additions & 0 deletions drivers/i2c/busses/i2c-designware-pcidrv.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ static struct dw_pci_controller dw_pci_controllers[] = {
.scl_sda_cfg = &hsw_config,
},
};

static struct i2c_algorithm i2c_dw_algo = {
.master_xfer = i2c_dw_xfer,
.functionality = i2c_dw_func,
Expand Down Expand Up @@ -350,6 +351,14 @@ static const struct pci_device_id i2_designware_pci_ids[] = {
/* Haswell */
{ PCI_VDEVICE(INTEL, 0x9c61), haswell },
{ PCI_VDEVICE(INTEL, 0x9c62), haswell },
/* Braswell / Cherrytrail */
{ PCI_VDEVICE(INTEL, 0x22C1), baytrail,},
{ PCI_VDEVICE(INTEL, 0x22C2), baytrail },
{ PCI_VDEVICE(INTEL, 0x22C3), baytrail },
{ PCI_VDEVICE(INTEL, 0x22C4), baytrail },
{ PCI_VDEVICE(INTEL, 0x22C5), baytrail },
{ PCI_VDEVICE(INTEL, 0x22C6), baytrail },
{ PCI_VDEVICE(INTEL, 0x22C7), baytrail },
{ 0,}
};
MODULE_DEVICE_TABLE(pci, i2_designware_pci_ids);
Expand Down
3 changes: 2 additions & 1 deletion drivers/i2c/busses/i2c-designware-platdrv.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ static const struct acpi_device_id dw_i2c_acpi_match[] = {
{ "INT3432", 0 },
{ "INT3433", 0 },
{ "80860F41", 0 },
{ "808622C1", 0 },
{ }
};
MODULE_DEVICE_TABLE(acpi, dw_i2c_acpi_match);
Expand Down Expand Up @@ -202,7 +203,7 @@ static int dw_i2c_probe(struct platform_device *pdev)
adap = &dev->adapter;
i2c_set_adapdata(adap, dev);
adap->owner = THIS_MODULE;
adap->class = I2C_CLASS_HWMON | I2C_CLASS_DEPRECATED;
adap->class = I2C_CLASS_DEPRECATED;
strlcpy(adap->name, "Synopsys DesignWare I2C adapter",
sizeof(adap->name));
adap->algo = &i2c_dw_algo;
Expand Down
8 changes: 7 additions & 1 deletion drivers/i2c/busses/i2c-efm32.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,13 @@ static int efm32_i2c_probe(struct platform_device *pdev)
return ret;
}

ret = of_property_read_u32(np, "efm32,location", &location);

ret = of_property_read_u32(np, "energymicro,location", &location);

if (ret)
/* fall back to wrongly namespaced property */
ret = of_property_read_u32(np, "efm32,location", &location);

if (!ret) {
dev_dbg(&pdev->dev, "using location %u\n", location);
} else {
Expand Down
16 changes: 11 additions & 5 deletions drivers/i2c/busses/i2c-exynos5.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,6 @@ static irqreturn_t exynos5_i2c_irq(int irqno, void *dev_id)

int_status = readl(i2c->regs + HSI2C_INT_STATUS);
writel(int_status, i2c->regs + HSI2C_INT_STATUS);
fifo_status = readl(i2c->regs + HSI2C_FIFO_STATUS);

/* handle interrupt related to the transfer status */
if (int_status & HSI2C_INT_I2C) {
Expand Down Expand Up @@ -526,7 +525,7 @@ static void exynos5_i2c_message_start(struct exynos5_i2c *i2c, int stop)
if (i2c->msg->flags & I2C_M_RD) {
i2c_ctl |= HSI2C_RXCHON;

i2c_auto_conf = HSI2C_READ_WRITE;
i2c_auto_conf |= HSI2C_READ_WRITE;

trig_lvl = (i2c->msg->len > i2c->variant->fifo_depth) ?
(i2c->variant->fifo_depth * 3 / 4) : i2c->msg->len;
Expand All @@ -549,7 +548,6 @@ static void exynos5_i2c_message_start(struct exynos5_i2c *i2c, int stop)
writel(fifo_ctl, i2c->regs + HSI2C_FIFO_CTL);
writel(i2c_ctl, i2c->regs + HSI2C_CTL);


/*
* Enable interrupts before starting the transfer so that we don't
* miss any INT_I2C interrupts.
Expand Down Expand Up @@ -789,8 +787,16 @@ static int exynos5_i2c_resume_noirq(struct device *dev)
}
#endif

static SIMPLE_DEV_PM_OPS(exynos5_i2c_dev_pm_ops, exynos5_i2c_suspend_noirq,
exynos5_i2c_resume_noirq);
static const struct dev_pm_ops exynos5_i2c_dev_pm_ops = {
#ifdef CONFIG_PM_SLEEP
.suspend_noirq = exynos5_i2c_suspend_noirq,
.resume_noirq = exynos5_i2c_resume_noirq,
.freeze_noirq = exynos5_i2c_suspend_noirq,
.thaw_noirq = exynos5_i2c_resume_noirq,
.poweroff_noirq = exynos5_i2c_suspend_noirq,
.restore_noirq = exynos5_i2c_resume_noirq,
#endif
};

static struct platform_driver exynos5_i2c_driver = {
.probe = exynos5_i2c_probe,
Expand Down
2 changes: 0 additions & 2 deletions drivers/i2c/busses/i2c-gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,10 @@ static int i2c_gpio_probe(struct platform_device *pdev)
static int i2c_gpio_remove(struct platform_device *pdev)
{
struct i2c_gpio_private_data *priv;
struct i2c_gpio_platform_data *pdata;
struct i2c_adapter *adap;

priv = platform_get_drvdata(pdev);
adap = &priv->adap;
pdata = &priv->pdata;

i2c_del_adapter(adap);

Expand Down
Loading

0 comments on commit f7dbaef

Please sign in to comment.