aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/Kconfig12
-rw-r--r--drivers/i2c/busses/i2c-designware-core.c17
-rw-r--r--drivers/i2c/busses/i2c-digicolor.c1
-rw-r--r--drivers/i2c/busses/i2c-i801.c16
-rw-r--r--drivers/i2c/busses/i2c-imx.c11
-rw-r--r--drivers/i2c/busses/i2c-jz4780.c1
-rw-r--r--drivers/i2c/busses/i2c-rk3x.c2
-rw-r--r--drivers/i2c/busses/i2c-xgene-slimpro.c2
-rw-r--r--drivers/i2c/busses/i2c-xlp9xx.c1
-rw-r--r--drivers/i2c/busses/i2c-xlr.c1
-rw-r--r--drivers/i2c/i2c-core.c11
11 files changed, 57 insertions, 18 deletions
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index 6d94e2ec5b4f..d252276feadf 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -79,12 +79,12 @@ config I2C_AMD8111
79 79
80config I2C_HIX5HD2 80config I2C_HIX5HD2
81 tristate "Hix5hd2 high-speed I2C driver" 81 tristate "Hix5hd2 high-speed I2C driver"
82 depends on ARCH_HIX5HD2 || COMPILE_TEST 82 depends on ARCH_HISI || ARCH_HIX5HD2 || COMPILE_TEST
83 help 83 help
84 Say Y here to include support for high-speed I2C controller in the 84 Say Y here to include support for the high-speed I2C controller
85 Hisilicon based hix5hd2 SoCs. 85 used in HiSilicon hix5hd2 SoCs.
86 86
87 This driver can also be built as a module. If so, the module 87 This driver can also be built as a module. If so, the module
88 will be called i2c-hix5hd2. 88 will be called i2c-hix5hd2.
89 89
90config I2C_I801 90config I2C_I801
@@ -589,10 +589,10 @@ config I2C_IMG
589 589
590config I2C_IMX 590config I2C_IMX
591 tristate "IMX I2C interface" 591 tristate "IMX I2C interface"
592 depends on ARCH_MXC || ARCH_LAYERSCAPE 592 depends on ARCH_MXC || ARCH_LAYERSCAPE || COLDFIRE
593 help 593 help
594 Say Y here if you want to use the IIC bus controller on 594 Say Y here if you want to use the IIC bus controller on
595 the Freescale i.MX/MXC or Layerscape processors. 595 the Freescale i.MX/MXC, Layerscape or ColdFire processors.
596 596
597 This driver can also be built as a module. If so, the module 597 This driver can also be built as a module. If so, the module
598 will be called i2c-imx. 598 will be called i2c-imx.
diff --git a/drivers/i2c/busses/i2c-designware-core.c b/drivers/i2c/busses/i2c-designware-core.c
index 1fe93c43215c..11e866d05368 100644
--- a/drivers/i2c/busses/i2c-designware-core.c
+++ b/drivers/i2c/busses/i2c-designware-core.c
@@ -95,6 +95,9 @@
95#define DW_IC_STATUS_TFE BIT(2) 95#define DW_IC_STATUS_TFE BIT(2)
96#define DW_IC_STATUS_MST_ACTIVITY BIT(5) 96#define DW_IC_STATUS_MST_ACTIVITY BIT(5)
97 97
98#define DW_IC_SDA_HOLD_RX_SHIFT 16
99#define DW_IC_SDA_HOLD_RX_MASK GENMASK(23, DW_IC_SDA_HOLD_RX_SHIFT)
100
98#define DW_IC_ERR_TX_ABRT 0x1 101#define DW_IC_ERR_TX_ABRT 0x1
99 102
100#define DW_IC_TAR_10BITADDR_MASTER BIT(12) 103#define DW_IC_TAR_10BITADDR_MASTER BIT(12)
@@ -420,12 +423,20 @@ int i2c_dw_init(struct dw_i2c_dev *dev)
420 /* Configure SDA Hold Time if required */ 423 /* Configure SDA Hold Time if required */
421 reg = dw_readl(dev, DW_IC_COMP_VERSION); 424 reg = dw_readl(dev, DW_IC_COMP_VERSION);
422 if (reg >= DW_IC_SDA_HOLD_MIN_VERS) { 425 if (reg >= DW_IC_SDA_HOLD_MIN_VERS) {
423 if (dev->sda_hold_time) { 426 if (!dev->sda_hold_time) {
424 dw_writel(dev, dev->sda_hold_time, DW_IC_SDA_HOLD);
425 } else {
426 /* Keep previous hold time setting if no one set it */ 427 /* Keep previous hold time setting if no one set it */
427 dev->sda_hold_time = dw_readl(dev, DW_IC_SDA_HOLD); 428 dev->sda_hold_time = dw_readl(dev, DW_IC_SDA_HOLD);
428 } 429 }
430 /*
431 * Workaround for avoiding TX arbitration lost in case I2C
432 * slave pulls SDA down "too quickly" after falling egde of
433 * SCL by enabling non-zero SDA RX hold. Specification says it
434 * extends incoming SDA low to high transition while SCL is
435 * high but it apprears to help also above issue.
436 */
437 if (!(dev->sda_hold_time & DW_IC_SDA_HOLD_RX_MASK))
438 dev->sda_hold_time |= 1 << DW_IC_SDA_HOLD_RX_SHIFT;
439 dw_writel(dev, dev->sda_hold_time, DW_IC_SDA_HOLD);
429 } else { 440 } else {
430 dev_warn(dev->dev, 441 dev_warn(dev->dev,
431 "Hardware too old to adjust SDA hold time.\n"); 442 "Hardware too old to adjust SDA hold time.\n");
diff --git a/drivers/i2c/busses/i2c-digicolor.c b/drivers/i2c/busses/i2c-digicolor.c
index 9604024e0eb0..49f2084f7bb5 100644
--- a/drivers/i2c/busses/i2c-digicolor.c
+++ b/drivers/i2c/busses/i2c-digicolor.c
@@ -368,6 +368,7 @@ static const struct of_device_id dc_i2c_match[] = {
368 { .compatible = "cnxt,cx92755-i2c" }, 368 { .compatible = "cnxt,cx92755-i2c" },
369 { }, 369 { },
370}; 370};
371MODULE_DEVICE_TABLE(of, dc_i2c_match);
371 372
372static struct platform_driver dc_i2c_driver = { 373static struct platform_driver dc_i2c_driver = {
373 .probe = dc_i2c_probe, 374 .probe = dc_i2c_probe,
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index 08847e8b8998..eb3627f35d12 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -146,6 +146,7 @@
146#define SMBHSTCFG_HST_EN 1 146#define SMBHSTCFG_HST_EN 1
147#define SMBHSTCFG_SMB_SMI_EN 2 147#define SMBHSTCFG_SMB_SMI_EN 2
148#define SMBHSTCFG_I2C_EN 4 148#define SMBHSTCFG_I2C_EN 4
149#define SMBHSTCFG_SPD_WD 0x10
149 150
150/* TCO configuration bits for TCOCTL */ 151/* TCO configuration bits for TCOCTL */
151#define TCOCTL_EN 0x0100 152#define TCOCTL_EN 0x0100
@@ -865,9 +866,16 @@ static s32 i801_access(struct i2c_adapter *adap, u16 addr,
865 block = 1; 866 block = 1;
866 break; 867 break;
867 case I2C_SMBUS_I2C_BLOCK_DATA: 868 case I2C_SMBUS_I2C_BLOCK_DATA:
868 /* NB: page 240 of ICH5 datasheet shows that the R/#W 869 /*
869 * bit should be cleared here, even when reading */ 870 * NB: page 240 of ICH5 datasheet shows that the R/#W
870 outb_p((addr & 0x7f) << 1, SMBHSTADD(priv)); 871 * bit should be cleared here, even when reading.
872 * However if SPD Write Disable is set (Lynx Point and later),
873 * the read will fail if we don't set the R/#W bit.
874 */
875 outb_p(((addr & 0x7f) << 1) |
876 ((priv->original_hstcfg & SMBHSTCFG_SPD_WD) ?
877 (read_write & 0x01) : 0),
878 SMBHSTADD(priv));
871 if (read_write == I2C_SMBUS_READ) { 879 if (read_write == I2C_SMBUS_READ) {
872 /* NB: page 240 of ICH5 datasheet also shows 880 /* NB: page 240 of ICH5 datasheet also shows
873 * that DATA1 is the cmd field when reading */ 881 * that DATA1 is the cmd field when reading */
@@ -1573,6 +1581,8 @@ static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id)
1573 /* Disable SMBus interrupt feature if SMBus using SMI# */ 1581 /* Disable SMBus interrupt feature if SMBus using SMI# */
1574 priv->features &= ~FEATURE_IRQ; 1582 priv->features &= ~FEATURE_IRQ;
1575 } 1583 }
1584 if (temp & SMBHSTCFG_SPD_WD)
1585 dev_info(&dev->dev, "SPD Write Disable is set\n");
1576 1586
1577 /* Clear special mode bits */ 1587 /* Clear special mode bits */
1578 if (priv->features & (FEATURE_SMBUS_PEC | FEATURE_BLOCK_BUFFER)) 1588 if (priv->features & (FEATURE_SMBUS_PEC | FEATURE_BLOCK_BUFFER))
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index 592a8f26a708..47fc1f1acff7 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -1009,10 +1009,13 @@ static int i2c_imx_init_recovery_info(struct imx_i2c_struct *i2c_imx,
1009 rinfo->sda_gpio = of_get_named_gpio(pdev->dev.of_node, "sda-gpios", 0); 1009 rinfo->sda_gpio = of_get_named_gpio(pdev->dev.of_node, "sda-gpios", 0);
1010 rinfo->scl_gpio = of_get_named_gpio(pdev->dev.of_node, "scl-gpios", 0); 1010 rinfo->scl_gpio = of_get_named_gpio(pdev->dev.of_node, "scl-gpios", 0);
1011 1011
1012 if (!gpio_is_valid(rinfo->sda_gpio) || 1012 if (rinfo->sda_gpio == -EPROBE_DEFER ||
1013 !gpio_is_valid(rinfo->scl_gpio) || 1013 rinfo->scl_gpio == -EPROBE_DEFER) {
1014 IS_ERR(i2c_imx->pinctrl_pins_default) || 1014 return -EPROBE_DEFER;
1015 IS_ERR(i2c_imx->pinctrl_pins_gpio)) { 1015 } else if (!gpio_is_valid(rinfo->sda_gpio) ||
1016 !gpio_is_valid(rinfo->scl_gpio) ||
1017 IS_ERR(i2c_imx->pinctrl_pins_default) ||
1018 IS_ERR(i2c_imx->pinctrl_pins_gpio)) {
1016 dev_dbg(&pdev->dev, "recovery information incomplete\n"); 1019 dev_dbg(&pdev->dev, "recovery information incomplete\n");
1017 return 0; 1020 return 0;
1018 } 1021 }
diff --git a/drivers/i2c/busses/i2c-jz4780.c b/drivers/i2c/busses/i2c-jz4780.c
index b8ea62105f42..30132c3957cd 100644
--- a/drivers/i2c/busses/i2c-jz4780.c
+++ b/drivers/i2c/busses/i2c-jz4780.c
@@ -729,6 +729,7 @@ static const struct of_device_id jz4780_i2c_of_matches[] = {
729 { .compatible = "ingenic,jz4780-i2c", }, 729 { .compatible = "ingenic,jz4780-i2c", },
730 { /* sentinel */ } 730 { /* sentinel */ }
731}; 731};
732MODULE_DEVICE_TABLE(of, jz4780_i2c_of_matches);
732 733
733static int jz4780_i2c_probe(struct platform_device *pdev) 734static int jz4780_i2c_probe(struct platform_device *pdev)
734{ 735{
diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c
index 50702c7bb244..df220666d627 100644
--- a/drivers/i2c/busses/i2c-rk3x.c
+++ b/drivers/i2c/busses/i2c-rk3x.c
@@ -694,6 +694,8 @@ static int rk3x_i2c_v0_calc_timings(unsigned long clk_rate,
694 t_calc->div_low--; 694 t_calc->div_low--;
695 t_calc->div_high--; 695 t_calc->div_high--;
696 696
697 /* Give the tuning value 0, that would not update con register */
698 t_calc->tuning = 0;
697 /* Maximum divider supported by hw is 0xffff */ 699 /* Maximum divider supported by hw is 0xffff */
698 if (t_calc->div_low > 0xffff) { 700 if (t_calc->div_low > 0xffff) {
699 t_calc->div_low = 0xffff; 701 t_calc->div_low = 0xffff;
diff --git a/drivers/i2c/busses/i2c-xgene-slimpro.c b/drivers/i2c/busses/i2c-xgene-slimpro.c
index 263685c7a512..05cf192ef1ac 100644
--- a/drivers/i2c/busses/i2c-xgene-slimpro.c
+++ b/drivers/i2c/busses/i2c-xgene-slimpro.c
@@ -105,7 +105,7 @@ struct slimpro_i2c_dev {
105 struct mbox_chan *mbox_chan; 105 struct mbox_chan *mbox_chan;
106 struct mbox_client mbox_client; 106 struct mbox_client mbox_client;
107 struct completion rd_complete; 107 struct completion rd_complete;
108 u8 dma_buffer[I2C_SMBUS_BLOCK_MAX]; 108 u8 dma_buffer[I2C_SMBUS_BLOCK_MAX + 1]; /* dma_buffer[0] is used for length */
109 u32 *resp_msg; 109 u32 *resp_msg;
110}; 110};
111 111
diff --git a/drivers/i2c/busses/i2c-xlp9xx.c b/drivers/i2c/busses/i2c-xlp9xx.c
index 2a972ed7aa0d..e29ff37a43bd 100644
--- a/drivers/i2c/busses/i2c-xlp9xx.c
+++ b/drivers/i2c/busses/i2c-xlp9xx.c
@@ -426,6 +426,7 @@ static const struct of_device_id xlp9xx_i2c_of_match[] = {
426 { .compatible = "netlogic,xlp980-i2c", }, 426 { .compatible = "netlogic,xlp980-i2c", },
427 { /* sentinel */ }, 427 { /* sentinel */ },
428}; 428};
429MODULE_DEVICE_TABLE(of, xlp9xx_i2c_of_match);
429 430
430#ifdef CONFIG_ACPI 431#ifdef CONFIG_ACPI
431static const struct acpi_device_id xlp9xx_i2c_acpi_ids[] = { 432static const struct acpi_device_id xlp9xx_i2c_acpi_ids[] = {
diff --git a/drivers/i2c/busses/i2c-xlr.c b/drivers/i2c/busses/i2c-xlr.c
index 0968f59b6df5..ad17d88d8573 100644
--- a/drivers/i2c/busses/i2c-xlr.c
+++ b/drivers/i2c/busses/i2c-xlr.c
@@ -358,6 +358,7 @@ static const struct of_device_id xlr_i2c_dt_ids[] = {
358 }, 358 },
359 { } 359 { }
360}; 360};
361MODULE_DEVICE_TABLE(of, xlr_i2c_dt_ids);
361 362
362static int xlr_i2c_probe(struct platform_device *pdev) 363static int xlr_i2c_probe(struct platform_device *pdev)
363{ 364{
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 5ab67219f71e..1704fc84d647 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -1681,6 +1681,7 @@ static struct i2c_client *of_i2c_register_device(struct i2c_adapter *adap,
1681static void of_i2c_register_devices(struct i2c_adapter *adap) 1681static void of_i2c_register_devices(struct i2c_adapter *adap)
1682{ 1682{
1683 struct device_node *bus, *node; 1683 struct device_node *bus, *node;
1684 struct i2c_client *client;
1684 1685
1685 /* Only register child devices if the adapter has a node pointer set */ 1686 /* Only register child devices if the adapter has a node pointer set */
1686 if (!adap->dev.of_node) 1687 if (!adap->dev.of_node)
@@ -1695,7 +1696,14 @@ static void of_i2c_register_devices(struct i2c_adapter *adap)
1695 for_each_available_child_of_node(bus, node) { 1696 for_each_available_child_of_node(bus, node) {
1696 if (of_node_test_and_set_flag(node, OF_POPULATED)) 1697 if (of_node_test_and_set_flag(node, OF_POPULATED))
1697 continue; 1698 continue;
1698 of_i2c_register_device(adap, node); 1699
1700 client = of_i2c_register_device(adap, node);
1701 if (IS_ERR(client)) {
1702 dev_warn(&adap->dev,
1703 "Failed to create I2C device for %s\n",
1704 node->full_name);
1705 of_node_clear_flag(node, OF_POPULATED);
1706 }
1699 } 1707 }
1700 1708
1701 of_node_put(bus); 1709 of_node_put(bus);
@@ -2299,6 +2307,7 @@ static int of_i2c_notify(struct notifier_block *nb, unsigned long action,
2299 if (IS_ERR(client)) { 2307 if (IS_ERR(client)) {
2300 dev_err(&adap->dev, "failed to create client for '%s'\n", 2308 dev_err(&adap->dev, "failed to create client for '%s'\n",
2301 rd->dn->full_name); 2309 rd->dn->full_name);
2310 of_node_clear_flag(rd->dn, OF_POPULATED);
2302 return notifier_from_errno(PTR_ERR(client)); 2311 return notifier_from_errno(PTR_ERR(client));
2303 } 2312 }
2304 break; 2313 break;