Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux

Pull i2c fixes from Wolfram Sang:
"Regular set of fixes for drivers and the dev-interface"

* 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
i2c: ismt: Fix undefined behavior due to shift overflowing the constant
i2c: dev: Force case user pointers in compat_i2cdev_ioctl()
i2c: dev: check return value when calling dev_set_name()
i2c: qcom-geni: Use dev_err_probe() for GPI DMA error
i2c: imx: Implement errata ERR007805 or e7805 bus frequency limit
i2c: pasemi: Wait for write xfers to finish

+54 -12
+33
drivers/i2c/busses/i2c-imx.c
··· 179 179 unsigned int ndivs; 180 180 unsigned int i2sr_clr_opcode; 181 181 unsigned int i2cr_ien_opcode; 182 + /* 183 + * Errata ERR007805 or e7805: 184 + * I2C: When the I2C clock speed is configured for 400 kHz, 185 + * the SCL low period violates the I2C spec of 1.3 uS min. 186 + */ 187 + bool has_err007805; 182 188 }; 183 189 184 190 struct imx_i2c_dma { ··· 246 240 247 241 }; 248 242 243 + static const struct imx_i2c_hwdata imx6_i2c_hwdata = { 244 + .devtype = IMX21_I2C, 245 + .regshift = IMX_I2C_REGSHIFT, 246 + .clk_div = imx_i2c_clk_div, 247 + .ndivs = ARRAY_SIZE(imx_i2c_clk_div), 248 + .i2sr_clr_opcode = I2SR_CLR_OPCODE_W0C, 249 + .i2cr_ien_opcode = I2CR_IEN_OPCODE_1, 250 + .has_err007805 = true, 251 + }; 252 + 249 253 static struct imx_i2c_hwdata vf610_i2c_hwdata = { 250 254 .devtype = VF610_I2C, 251 255 .regshift = VF610_I2C_REGSHIFT, ··· 282 266 static const struct of_device_id i2c_imx_dt_ids[] = { 283 267 { .compatible = "fsl,imx1-i2c", .data = &imx1_i2c_hwdata, }, 284 268 { .compatible = "fsl,imx21-i2c", .data = &imx21_i2c_hwdata, }, 269 + { .compatible = "fsl,imx6q-i2c", .data = &imx6_i2c_hwdata, }, 270 + { .compatible = "fsl,imx6sl-i2c", .data = &imx6_i2c_hwdata, }, 271 + { .compatible = "fsl,imx6sll-i2c", .data = &imx6_i2c_hwdata, }, 272 + { .compatible = "fsl,imx6sx-i2c", .data = &imx6_i2c_hwdata, }, 273 + { .compatible = "fsl,imx6ul-i2c", .data = &imx6_i2c_hwdata, }, 274 + { .compatible = "fsl,imx7s-i2c", .data = &imx6_i2c_hwdata, }, 275 + { .compatible = "fsl,imx8mm-i2c", .data = &imx6_i2c_hwdata, }, 276 + { .compatible = "fsl,imx8mn-i2c", .data = &imx6_i2c_hwdata, }, 277 + { .compatible = "fsl,imx8mp-i2c", .data = &imx6_i2c_hwdata, }, 278 + { .compatible = "fsl,imx8mq-i2c", .data = &imx6_i2c_hwdata, }, 285 279 { .compatible = "fsl,vf610-i2c", .data = &vf610_i2c_hwdata, }, 286 280 { /* sentinel */ } 287 281 }; ··· 576 550 struct imx_i2c_clk_pair *i2c_clk_div = i2c_imx->hwdata->clk_div; 577 551 unsigned int div; 578 552 int i; 553 + 554 + if (i2c_imx->hwdata->has_err007805 && i2c_imx->bitrate > 384000) { 555 + dev_dbg(&i2c_imx->adapter.dev, 556 + "SoC errata ERR007805 or e7805 applies, bus frequency limited from %d Hz to 384000 Hz.\n", 557 + i2c_imx->bitrate); 558 + i2c_imx->bitrate = 384000; 559 + } 579 560 580 561 /* Divider value calculation */ 581 562 if (i2c_imx->cur_clk == i2c_clk_rate)
+2 -2
drivers/i2c/busses/i2c-ismt.c
··· 145 145 #define ISMT_SPGT_SPD_MASK 0xc0000000 /* SMBus Speed mask */ 146 146 #define ISMT_SPGT_SPD_80K 0x00 /* 80 kHz */ 147 147 #define ISMT_SPGT_SPD_100K (0x1 << 30) /* 100 kHz */ 148 - #define ISMT_SPGT_SPD_400K (0x2 << 30) /* 400 kHz */ 149 - #define ISMT_SPGT_SPD_1M (0x3 << 30) /* 1 MHz */ 148 + #define ISMT_SPGT_SPD_400K (0x2U << 30) /* 400 kHz */ 149 + #define ISMT_SPGT_SPD_1M (0x3U << 30) /* 1 MHz */ 150 150 151 151 152 152 /* MSI Control Register (MSICTL) bit definitions */
+6
drivers/i2c/busses/i2c-pasemi-core.c
··· 137 137 138 138 TXFIFO_WR(smbus, msg->buf[msg->len-1] | 139 139 (stop ? MTXFIFO_STOP : 0)); 140 + 141 + if (stop) { 142 + err = pasemi_smb_waitready(smbus); 143 + if (err) 144 + goto reset_out; 145 + } 140 146 } 141 147 142 148 return 0;
+2 -4
drivers/i2c/busses/i2c-qcom-geni.c
··· 843 843 /* FIFO is disabled, so we can only use GPI DMA */ 844 844 gi2c->gpi_mode = true; 845 845 ret = setup_gpi_dma(gi2c); 846 - if (ret) { 847 - dev_err(dev, "Failed to setup GPI DMA mode:%d ret\n", ret); 848 - return ret; 849 - } 846 + if (ret) 847 + return dev_err_probe(dev, ret, "Failed to setup GPI DMA mode\n"); 850 848 851 849 dev_dbg(dev, "Using GPI DMA mode for I2C\n"); 852 850 } else {
+11 -6
drivers/i2c/i2c-dev.c
··· 557 557 .addr = umsg.addr, 558 558 .flags = umsg.flags, 559 559 .len = umsg.len, 560 - .buf = compat_ptr(umsg.buf) 560 + .buf = (__force __u8 *)compat_ptr(umsg.buf), 561 561 }; 562 562 } 563 563 ··· 668 668 i2c_dev->dev.class = i2c_dev_class; 669 669 i2c_dev->dev.parent = &adap->dev; 670 670 i2c_dev->dev.release = i2cdev_dev_release; 671 - dev_set_name(&i2c_dev->dev, "i2c-%d", adap->nr); 671 + 672 + res = dev_set_name(&i2c_dev->dev, "i2c-%d", adap->nr); 673 + if (res) 674 + goto err_put_i2c_dev; 672 675 673 676 res = cdev_device_add(&i2c_dev->cdev, &i2c_dev->dev); 674 - if (res) { 675 - put_i2c_dev(i2c_dev, false); 676 - return res; 677 - } 677 + if (res) 678 + goto err_put_i2c_dev; 678 679 679 680 pr_debug("adapter [%s] registered as minor %d\n", adap->name, adap->nr); 680 681 return 0; 682 + 683 + err_put_i2c_dev: 684 + put_i2c_dev(i2c_dev, false); 685 + return res; 681 686 } 682 687 683 688 static int i2cdev_detach_adapter(struct device *dev, void *dummy)