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:
"Another bunch of driver fixes"

* 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
i2c: sprd: depend on COMMON_CLK to fix compile tests
Revert "i2c: imx: Remove unused .id_table support"
i2c: octeon: check correct size of maximum RECV_LEN packet
i2c: tegra: Create i2c_writesl_vi() to use with VI I2C for filling TX FIFO
i2c: bpmp-tegra: Ignore unknown I2C_M flags
i2c: tegra: Wait for config load atomically while in ISR

+44 -5
+1
drivers/i2c/busses/Kconfig
··· 1013 1013 config I2C_SPRD 1014 1014 tristate "Spreadtrum I2C interface" 1015 1015 depends on I2C=y && (ARCH_SPRD || COMPILE_TEST) 1016 + depends on COMMON_CLK 1016 1017 help 1017 1018 If you say yes to this option, support will be included for the 1018 1019 Spreadtrum I2C interface.
+19 -1
drivers/i2c/busses/i2c-imx.c
··· 241 241 242 242 }; 243 243 244 + static const struct platform_device_id imx_i2c_devtype[] = { 245 + { 246 + .name = "imx1-i2c", 247 + .driver_data = (kernel_ulong_t)&imx1_i2c_hwdata, 248 + }, { 249 + .name = "imx21-i2c", 250 + .driver_data = (kernel_ulong_t)&imx21_i2c_hwdata, 251 + }, { 252 + /* sentinel */ 253 + } 254 + }; 255 + MODULE_DEVICE_TABLE(platform, imx_i2c_devtype); 256 + 244 257 static const struct of_device_id i2c_imx_dt_ids[] = { 245 258 { .compatible = "fsl,imx1-i2c", .data = &imx1_i2c_hwdata, }, 246 259 { .compatible = "fsl,imx21-i2c", .data = &imx21_i2c_hwdata, }, ··· 1343 1330 return -ENOMEM; 1344 1331 1345 1332 match = device_get_match_data(&pdev->dev); 1346 - i2c_imx->hwdata = match; 1333 + if (match) 1334 + i2c_imx->hwdata = match; 1335 + else 1336 + i2c_imx->hwdata = (struct imx_i2c_hwdata *) 1337 + platform_get_device_id(pdev)->driver_data; 1347 1338 1348 1339 /* Setup i2c_imx driver structure */ 1349 1340 strlcpy(i2c_imx->adapter.name, pdev->name, sizeof(i2c_imx->adapter.name)); ··· 1515 1498 .of_match_table = i2c_imx_dt_ids, 1516 1499 .acpi_match_table = i2c_imx_acpi_ids, 1517 1500 }, 1501 + .id_table = imx_i2c_devtype, 1518 1502 }; 1519 1503 1520 1504 static int __init i2c_adap_imx_init(void)
+1 -1
drivers/i2c/busses/i2c-octeon-core.c
··· 347 347 if (result) 348 348 return result; 349 349 if (recv_len && i == 0) { 350 - if (data[i] > I2C_SMBUS_BLOCK_MAX + 1) 350 + if (data[i] > I2C_SMBUS_BLOCK_MAX) 351 351 return -EPROTO; 352 352 length += data[i]; 353 353 }
+1 -1
drivers/i2c/busses/i2c-tegra-bpmp.c
··· 80 80 flags &= ~I2C_M_RECV_LEN; 81 81 } 82 82 83 - return (flags != 0) ? -EINVAL : 0; 83 + return 0; 84 84 } 85 85 86 86 /**
+22 -2
drivers/i2c/busses/i2c-tegra.c
··· 326 326 /* read back register to make sure that register writes completed */ 327 327 if (reg != I2C_TX_FIFO) 328 328 readl_relaxed(i2c_dev->base + tegra_i2c_reg_addr(i2c_dev, reg)); 329 + else if (i2c_dev->is_vi) 330 + readl_relaxed(i2c_dev->base + tegra_i2c_reg_addr(i2c_dev, I2C_INT_STATUS)); 329 331 } 330 332 331 333 static u32 i2c_readl(struct tegra_i2c_dev *i2c_dev, unsigned int reg) ··· 339 337 unsigned int reg, unsigned int len) 340 338 { 341 339 writesl(i2c_dev->base + tegra_i2c_reg_addr(i2c_dev, reg), data, len); 340 + } 341 + 342 + static void i2c_writesl_vi(struct tegra_i2c_dev *i2c_dev, void *data, 343 + unsigned int reg, unsigned int len) 344 + { 345 + u32 *data32 = data; 346 + 347 + /* 348 + * VI I2C controller has known hardware bug where writes get stuck 349 + * when immediate multiple writes happen to TX_FIFO register. 350 + * Recommended software work around is to read I2C register after 351 + * each write to TX_FIFO register to flush out the data. 352 + */ 353 + while (len--) 354 + i2c_writel(i2c_dev, *data32++, reg); 342 355 } 343 356 344 357 static void i2c_readsl(struct tegra_i2c_dev *i2c_dev, void *data, ··· 550 533 void __iomem *addr = i2c_dev->base + tegra_i2c_reg_addr(i2c_dev, reg); 551 534 u32 val; 552 535 553 - if (!i2c_dev->atomic_mode) 536 + if (!i2c_dev->atomic_mode && !in_irq()) 554 537 return readl_relaxed_poll_timeout(addr, val, !(val & mask), 555 538 delay_us, timeout_us); 556 539 ··· 828 811 i2c_dev->msg_buf_remaining = buf_remaining; 829 812 i2c_dev->msg_buf = buf + words_to_transfer * BYTES_PER_FIFO_WORD; 830 813 831 - i2c_writesl(i2c_dev, buf, I2C_TX_FIFO, words_to_transfer); 814 + if (i2c_dev->is_vi) 815 + i2c_writesl_vi(i2c_dev, buf, I2C_TX_FIFO, words_to_transfer); 816 + else 817 + i2c_writesl(i2c_dev, buf, I2C_TX_FIFO, words_to_transfer); 832 818 833 819 buf += words_to_transfer * BYTES_PER_FIFO_WORD; 834 820 }