Skip to content

Commit 4e68af0

Browse files
committed
Merge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux
Pull i2c fixes from Wolfram Sang: "I2C has some driver bugfixes, module autoload fixes, and driver enablement on some architectures" * 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: i2c: imx: defer probe if bus recovery GPIOs are not ready i2c: designware: Avoid aborted transfers with fast reacting I2C slaves i2c: i801: Fix I2C Block Read on 8-Series/C220 and later i2c: xgene: Avoid dma_buffer overrun i2c: digicolor: Fix module autoload i2c: xlr: Fix module autoload for OF registration i2c: xlp9xx: Fix module autoload i2c: jz4780: Fix module autoload i2c: allow configuration of imx driver for ColdFire architecture i2c: mark device nodes only in case of successful instantiation i2c: rk3x: Give the tuning value 0 during rk3x_i2c_v0_calc_timings i2c: hix5hd2: allow build with ARCH_HISI
2 parents 7f2145b + 533169d commit 4e68af0

11 files changed

Lines changed: 57 additions & 18 deletions

File tree

drivers/i2c/busses/Kconfig

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,12 @@ config I2C_AMD8111
7979

8080
config I2C_HIX5HD2
8181
tristate "Hix5hd2 high-speed I2C driver"
82-
depends on ARCH_HIX5HD2 || COMPILE_TEST
82+
depends on ARCH_HISI || ARCH_HIX5HD2 || COMPILE_TEST
8383
help
84-
Say Y here to include support for high-speed I2C controller in the
85-
Hisilicon based hix5hd2 SoCs.
84+
Say Y here to include support for the high-speed I2C controller
85+
used in HiSilicon hix5hd2 SoCs.
8686

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
8888
will be called i2c-hix5hd2.
8989

9090
config I2C_I801
@@ -589,10 +589,10 @@ config I2C_IMG
589589

590590
config I2C_IMX
591591
tristate "IMX I2C interface"
592-
depends on ARCH_MXC || ARCH_LAYERSCAPE
592+
depends on ARCH_MXC || ARCH_LAYERSCAPE || COLDFIRE
593593
help
594594
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.
596596

597597
This driver can also be built as a module. If so, the module
598598
will be called i2c-imx.

drivers/i2c/busses/i2c-designware-core.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@
9595
#define DW_IC_STATUS_TFE BIT(2)
9696
#define DW_IC_STATUS_MST_ACTIVITY BIT(5)
9797

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+
98101
#define DW_IC_ERR_TX_ABRT 0x1
99102

100103
#define DW_IC_TAR_10BITADDR_MASTER BIT(12)
@@ -420,12 +423,20 @@ int i2c_dw_init(struct dw_i2c_dev *dev)
420423
/* Configure SDA Hold Time if required */
421424
reg = dw_readl(dev, DW_IC_COMP_VERSION);
422425
if (reg >= DW_IC_SDA_HOLD_MIN_VERS) {
423-
if (dev->sda_hold_time) {
424-
dw_writel(dev, dev->sda_hold_time, DW_IC_SDA_HOLD);
425-
} else {
426+
if (!dev->sda_hold_time) {
426427
/* Keep previous hold time setting if no one set it */
427428
dev->sda_hold_time = dw_readl(dev, DW_IC_SDA_HOLD);
428429
}
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);
429440
} else {
430441
dev_warn(dev->dev,
431442
"Hardware too old to adjust SDA hold time.\n");

drivers/i2c/busses/i2c-digicolor.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@ static const struct of_device_id dc_i2c_match[] = {
368368
{ .compatible = "cnxt,cx92755-i2c" },
369369
{ },
370370
};
371+
MODULE_DEVICE_TABLE(of, dc_i2c_match);
371372

372373
static struct platform_driver dc_i2c_driver = {
373374
.probe = dc_i2c_probe,

drivers/i2c/busses/i2c-i801.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@
146146
#define SMBHSTCFG_HST_EN 1
147147
#define SMBHSTCFG_SMB_SMI_EN 2
148148
#define SMBHSTCFG_I2C_EN 4
149+
#define SMBHSTCFG_SPD_WD 0x10
149150

150151
/* TCO configuration bits for TCOCTL */
151152
#define TCOCTL_EN 0x0100
@@ -865,9 +866,16 @@ static s32 i801_access(struct i2c_adapter *adap, u16 addr,
865866
block = 1;
866867
break;
867868
case I2C_SMBUS_I2C_BLOCK_DATA:
868-
/* NB: page 240 of ICH5 datasheet shows that the R/#W
869-
* bit should be cleared here, even when reading */
870-
outb_p((addr & 0x7f) << 1, SMBHSTADD(priv));
869+
/*
870+
* NB: page 240 of ICH5 datasheet shows that the R/#W
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));
871879
if (read_write == I2C_SMBUS_READ) {
872880
/* NB: page 240 of ICH5 datasheet also shows
873881
* 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)
15731581
/* Disable SMBus interrupt feature if SMBus using SMI# */
15741582
priv->features &= ~FEATURE_IRQ;
15751583
}
1584+
if (temp & SMBHSTCFG_SPD_WD)
1585+
dev_info(&dev->dev, "SPD Write Disable is set\n");
15761586

15771587
/* Clear special mode bits */
15781588
if (priv->features & (FEATURE_SMBUS_PEC | FEATURE_BLOCK_BUFFER))

drivers/i2c/busses/i2c-imx.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,10 +1009,13 @@ static int i2c_imx_init_recovery_info(struct imx_i2c_struct *i2c_imx,
10091009
rinfo->sda_gpio = of_get_named_gpio(pdev->dev.of_node, "sda-gpios", 0);
10101010
rinfo->scl_gpio = of_get_named_gpio(pdev->dev.of_node, "scl-gpios", 0);
10111011

1012-
if (!gpio_is_valid(rinfo->sda_gpio) ||
1013-
!gpio_is_valid(rinfo->scl_gpio) ||
1014-
IS_ERR(i2c_imx->pinctrl_pins_default) ||
1015-
IS_ERR(i2c_imx->pinctrl_pins_gpio)) {
1012+
if (rinfo->sda_gpio == -EPROBE_DEFER ||
1013+
rinfo->scl_gpio == -EPROBE_DEFER) {
1014+
return -EPROBE_DEFER;
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)) {
10161019
dev_dbg(&pdev->dev, "recovery information incomplete\n");
10171020
return 0;
10181021
}

drivers/i2c/busses/i2c-jz4780.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,7 @@ static const struct of_device_id jz4780_i2c_of_matches[] = {
729729
{ .compatible = "ingenic,jz4780-i2c", },
730730
{ /* sentinel */ }
731731
};
732+
MODULE_DEVICE_TABLE(of, jz4780_i2c_of_matches);
732733

733734
static int jz4780_i2c_probe(struct platform_device *pdev)
734735
{

drivers/i2c/busses/i2c-rk3x.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,8 @@ static int rk3x_i2c_v0_calc_timings(unsigned long clk_rate,
694694
t_calc->div_low--;
695695
t_calc->div_high--;
696696

697+
/* Give the tuning value 0, that would not update con register */
698+
t_calc->tuning = 0;
697699
/* Maximum divider supported by hw is 0xffff */
698700
if (t_calc->div_low > 0xffff) {
699701
t_calc->div_low = 0xffff;

drivers/i2c/busses/i2c-xgene-slimpro.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ struct slimpro_i2c_dev {
105105
struct mbox_chan *mbox_chan;
106106
struct mbox_client mbox_client;
107107
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 */
109109
u32 *resp_msg;
110110
};
111111

drivers/i2c/busses/i2c-xlp9xx.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,7 @@ static const struct of_device_id xlp9xx_i2c_of_match[] = {
426426
{ .compatible = "netlogic,xlp980-i2c", },
427427
{ /* sentinel */ },
428428
};
429+
MODULE_DEVICE_TABLE(of, xlp9xx_i2c_of_match);
429430

430431
#ifdef CONFIG_ACPI
431432
static const struct acpi_device_id xlp9xx_i2c_acpi_ids[] = {

drivers/i2c/busses/i2c-xlr.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ static const struct of_device_id xlr_i2c_dt_ids[] = {
358358
},
359359
{ }
360360
};
361+
MODULE_DEVICE_TABLE(of, xlr_i2c_dt_ids);
361362

362363
static int xlr_i2c_probe(struct platform_device *pdev)
363364
{

0 commit comments

Comments
 (0)