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

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

Pull i2c updates from Wolfram Sang:

- bus recovery can now be given a pinctrl handle and the I2C core will
do all the steps to switch to/from GPIO which can save quite some
boilerplate code from drivers

- "fallthrough" conversion

- driver updates, mostly ID additions

* 'i2c/for-5.9' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (32 commits)
i2c: iproc: fix race between client unreg and isr
i2c: eg20t: use generic power management
i2c: eg20t: Drop PCI wakeup calls from .suspend/.resume
i2c: mediatek: Fix i2c_spec_values description
i2c: mediatek: Add i2c compatible for MediaTek MT8192
dt-bindings: i2c: update bindings for MT8192 SoC
i2c: mediatek: Add access to more than 8GB dram in i2c driver
i2c: mediatek: Add apdma sync in i2c driver
i2c: i801: Add support for Intel Tiger Lake PCH-H
i2c: i801: Add support for Intel Emmitsburg PCH
i2c: bcm2835: Replace HTTP links with HTTPS ones
Documentation: i2c: dev: 'block process call' is supported
i2c: at91: Move to generic GPIO bus recovery
i2c: core: treat EPROBE_DEFER when acquiring SCL/SDA GPIOs
i2c: core: add generic I2C GPIO recovery
dt-bindings: i2c: add generic properties for GPIO bus recovery
i2c: rcar: avoid race when unregistering slave
i2c: tegra: Avoid tegra_i2c_init_dma() for Tegra210 vi i2c
i2c: tegra: Fix runtime resume to re-init VI I2C
i2c: tegra: Fix the error path in tegra_i2c_runtime_resume
...

+409 -250
+1
Documentation/devicetree/bindings/i2c/i2c-mt65xx.txt
··· 14 14 "mediatek,mt7629-i2c", "mediatek,mt2712-i2c": for MediaTek MT7629 15 15 "mediatek,mt8173-i2c": for MediaTek MT8173 16 16 "mediatek,mt8183-i2c": for MediaTek MT8183 17 + "mediatek,mt8192-i2c": for MediaTek MT8192 17 18 "mediatek,mt8516-i2c", "mediatek,mt2712-i2c": for MediaTek MT8516 18 19 - reg: physical base address of the controller and dma base, length of memory 19 20 mapped region.
+10
Documentation/devicetree/bindings/i2c/i2c.txt
··· 72 72 this information to adapt power management to keep the arbitration awake 73 73 all the time, for example. Can not be combined with 'single-master'. 74 74 75 + - pinctrl 76 + add extra pinctrl to configure SCL/SDA pins to GPIO function for bus 77 + recovery, call it "gpio" or "recovery" (deprecated) state 78 + 79 + - scl-gpios 80 + specify the gpio related to SCL pin. Used for GPIO bus recovery. 81 + 82 + - sda-gpios 83 + specify the gpio related to SDA pin. Optional for GPIO bus recovery. 84 + 75 85 - single-master 76 86 states that there is no other master active on this bus. The OS can use 77 87 this information to detect a stalled bus more reliably, for example.
+3
Documentation/devicetree/bindings/i2c/marvell,mv64xxx-i2c.yaml
··· 27 27 - const: allwinner,sun50i-a64-i2c 28 28 - const: allwinner,sun6i-a31-i2c 29 29 - items: 30 + - const: allwinner,sun50i-a100-i2c 31 + - const: allwinner,sun6i-a31-i2c 32 + - items: 30 33 - const: allwinner,sun50i-h6-i2c 31 34 - const: allwinner,sun6i-a31-i2c 32 35
+1
Documentation/devicetree/bindings/i2c/renesas,i2c.txt
··· 10 10 "renesas,i2c-r8a774a1" if the device is a part of a R8A774A1 SoC. 11 11 "renesas,i2c-r8a774b1" if the device is a part of a R8A774B1 SoC. 12 12 "renesas,i2c-r8a774c0" if the device is a part of a R8A774C0 SoC. 13 + "renesas,i2c-r8a774e1" if the device is a part of a R8A774E1 SoC. 13 14 "renesas,i2c-r8a7778" if the device is a part of a R8A7778 SoC. 14 15 "renesas,i2c-r8a7779" if the device is a part of a R8A7779 SoC. 15 16 "renesas,i2c-r8a7790" if the device is a part of a R8A7790 SoC.
+1
Documentation/devicetree/bindings/i2c/renesas,iic.txt
··· 11 11 - "renesas,iic-r8a774a1" (RZ/G2M) 12 12 - "renesas,iic-r8a774b1" (RZ/G2N) 13 13 - "renesas,iic-r8a774c0" (RZ/G2E) 14 + - "renesas,iic-r8a774e1" (RZ/G2H) 14 15 - "renesas,iic-r8a7790" (R-Car H2) 15 16 - "renesas,iic-r8a7791" (R-Car M2-W) 16 17 - "renesas,iic-r8a7792" (R-Car V2H)
+1
Documentation/i2c/busses/i2c-i801.rst
··· 43 43 * Intel Elkhart Lake (PCH) 44 44 * Intel Tiger Lake (PCH) 45 45 * Intel Jasper Lake (SOC) 46 + * Intel Emmitsburg (PCH) 46 47 47 48 Datasheets: Publicly available at the Intel website 48 49
+2
Documentation/i2c/dev-interface.rst
··· 159 159 __s32 i2c_smbus_read_word_data(int file, __u8 command); 160 160 __s32 i2c_smbus_write_word_data(int file, __u8 command, __u16 value); 161 161 __s32 i2c_smbus_process_call(int file, __u8 command, __u16 value); 162 + __s32 i2c_smbus_block_process_call(int file, __u8 command, __u8 length, 163 + __u8 *values); 162 164 __s32 i2c_smbus_read_block_data(int file, __u8 command, __u8 *values); 163 165 __s32 i2c_smbus_write_block_data(int file, __u8 command, __u8 length, 164 166 __u8 *values);
+2 -2
drivers/i2c/algos/i2c-algo-pca.c
··· 542 542 } 543 543 EXPORT_SYMBOL(i2c_pca_add_numbered_bus); 544 544 545 - MODULE_AUTHOR("Ian Campbell <icampbell@arcom.com>, " 546 - "Wolfram Sang <kernel@pengutronix.de>"); 545 + MODULE_AUTHOR("Ian Campbell <icampbell@arcom.com>"); 546 + MODULE_AUTHOR("Wolfram Sang <kernel@pengutronix.de>"); 547 547 MODULE_DESCRIPTION("I2C-Bus PCA9564/PCA9665 algorithm"); 548 548 MODULE_LICENSE("GPL"); 549 549
+1
drivers/i2c/busses/Kconfig
··· 146 146 Elkhart Lake (PCH) 147 147 Tiger Lake (PCH) 148 148 Jasper Lake (SOC) 149 + Emmitsburg (PCH) 149 150 150 151 This driver can also be built as a module. If so, the module 151 152 will be called i2c-i801.
+4 -4
drivers/i2c/busses/i2c-ali1535.c
··· 519 519 520 520 module_pci_driver(ali1535_driver); 521 521 522 - MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl>, " 523 - "Philip Edelbrock <phil@netroedge.com>, " 524 - "Mark D. Studebaker <mdsxyz123@yahoo.com> " 525 - "and Dan Eaton <dan.eaton@rocketlogix.com>"); 522 + MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl>"); 523 + MODULE_AUTHOR("Philip Edelbrock <phil@netroedge.com>"); 524 + MODULE_AUTHOR("Mark D. Studebaker <mdsxyz123@yahoo.com>"); 525 + MODULE_AUTHOR("Dan Eaton <dan.eaton@rocketlogix.com>"); 526 526 MODULE_DESCRIPTION("ALI1535 SMBus driver"); 527 527 MODULE_LICENSE("GPL");
+3 -3
drivers/i2c/busses/i2c-ali15x3.c
··· 502 502 503 503 module_pci_driver(ali15x3_driver); 504 504 505 - MODULE_AUTHOR ("Frodo Looijaard <frodol@dds.nl>, " 506 - "Philip Edelbrock <phil@netroedge.com>, " 507 - "and Mark D. Studebaker <mdsxyz123@yahoo.com>"); 505 + MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl>"); 506 + MODULE_AUTHOR("Philip Edelbrock <phil@netroedge.com>"); 507 + MODULE_AUTHOR("Mark D. Studebaker <mdsxyz123@yahoo.com>"); 508 508 MODULE_DESCRIPTION("ALI15X3 SMBus driver"); 509 509 MODULE_LICENSE("GPL");
+1 -1
drivers/i2c/busses/i2c-amd8111.c
··· 381 381 if (status) 382 382 return status; 383 383 len = min_t(u8, len, I2C_SMBUS_BLOCK_MAX); 384 - /* fall through */ 384 + fallthrough; 385 385 case I2C_SMBUS_I2C_BLOCK_DATA: 386 386 for (i = 0; i < len; i++) { 387 387 status = amd_ec_read(smbus, AMD_SMB_DATA + i,
+2 -2
drivers/i2c/busses/i2c-aspeed.c
··· 504 504 goto error_and_stop; 505 505 } 506 506 irq_handled |= ASPEED_I2CD_INTR_TX_ACK; 507 - /* fall through */ 507 + fallthrough; 508 508 case ASPEED_I2C_MASTER_TX_FIRST: 509 509 if (bus->buf_index < msg->len) { 510 510 bus->master_state = ASPEED_I2C_MASTER_TX; ··· 520 520 /* RX may not have completed yet (only address cycle) */ 521 521 if (!(irq_status & ASPEED_I2CD_INTR_RX_DONE)) 522 522 goto out_no_complete; 523 - /* fall through */ 523 + fallthrough; 524 524 case ASPEED_I2C_MASTER_RX: 525 525 if (unlikely(!(irq_status & ASPEED_I2CD_INTR_RX_DONE))) { 526 526 dev_err(bus->dev, "master failed to RX\n");
+3 -66
drivers/i2c/busses/i2c-at91-master.c
··· 816 816 return ret; 817 817 } 818 818 819 - static void at91_prepare_twi_recovery(struct i2c_adapter *adap) 820 - { 821 - struct at91_twi_dev *dev = i2c_get_adapdata(adap); 822 - 823 - pinctrl_select_state(dev->pinctrl, dev->pinctrl_pins_gpio); 824 - } 825 - 826 - static void at91_unprepare_twi_recovery(struct i2c_adapter *adap) 827 - { 828 - struct at91_twi_dev *dev = i2c_get_adapdata(adap); 829 - 830 - pinctrl_select_state(dev->pinctrl, dev->pinctrl_pins_default); 831 - } 832 - 833 819 static int at91_init_twi_recovery_gpio(struct platform_device *pdev, 834 820 struct at91_twi_dev *dev) 835 821 { 836 822 struct i2c_bus_recovery_info *rinfo = &dev->rinfo; 837 823 838 - dev->pinctrl = devm_pinctrl_get(&pdev->dev); 839 - if (!dev->pinctrl || IS_ERR(dev->pinctrl)) { 824 + rinfo->pinctrl = devm_pinctrl_get(&pdev->dev); 825 + if (!rinfo->pinctrl || IS_ERR(rinfo->pinctrl)) { 840 826 dev_info(dev->dev, "can't get pinctrl, bus recovery not supported\n"); 841 - return PTR_ERR(dev->pinctrl); 827 + return PTR_ERR(rinfo->pinctrl); 842 828 } 843 - 844 - dev->pinctrl_pins_default = pinctrl_lookup_state(dev->pinctrl, 845 - PINCTRL_STATE_DEFAULT); 846 - dev->pinctrl_pins_gpio = pinctrl_lookup_state(dev->pinctrl, 847 - "gpio"); 848 - if (IS_ERR(dev->pinctrl_pins_default) || 849 - IS_ERR(dev->pinctrl_pins_gpio)) { 850 - dev_info(&pdev->dev, "pinctrl states incomplete for recovery\n"); 851 - return -EINVAL; 852 - } 853 - 854 - /* 855 - * pins will be taken as GPIO, so we might as well inform pinctrl about 856 - * this and move the state to GPIO 857 - */ 858 - pinctrl_select_state(dev->pinctrl, dev->pinctrl_pins_gpio); 859 - 860 - rinfo->sda_gpiod = devm_gpiod_get(&pdev->dev, "sda", GPIOD_IN); 861 - if (PTR_ERR(rinfo->sda_gpiod) == -EPROBE_DEFER) 862 - return -EPROBE_DEFER; 863 - 864 - rinfo->scl_gpiod = devm_gpiod_get(&pdev->dev, "scl", 865 - GPIOD_OUT_HIGH_OPEN_DRAIN); 866 - if (PTR_ERR(rinfo->scl_gpiod) == -EPROBE_DEFER) 867 - return -EPROBE_DEFER; 868 - 869 - if (IS_ERR(rinfo->sda_gpiod) || 870 - IS_ERR(rinfo->scl_gpiod)) { 871 - dev_info(&pdev->dev, "recovery information incomplete\n"); 872 - if (!IS_ERR(rinfo->sda_gpiod)) { 873 - gpiod_put(rinfo->sda_gpiod); 874 - rinfo->sda_gpiod = NULL; 875 - } 876 - if (!IS_ERR(rinfo->scl_gpiod)) { 877 - gpiod_put(rinfo->scl_gpiod); 878 - rinfo->scl_gpiod = NULL; 879 - } 880 - pinctrl_select_state(dev->pinctrl, dev->pinctrl_pins_default); 881 - return -EINVAL; 882 - } 883 - 884 - /* change the state of the pins back to their default state */ 885 - pinctrl_select_state(dev->pinctrl, dev->pinctrl_pins_default); 886 - 887 - dev_info(&pdev->dev, "using scl, sda for recovery\n"); 888 - 889 - rinfo->prepare_recovery = at91_prepare_twi_recovery; 890 - rinfo->unprepare_recovery = at91_unprepare_twi_recovery; 891 - rinfo->recover_bus = i2c_generic_scl_recovery; 892 829 dev->adapter.bus_recovery_info = rinfo; 893 830 894 831 return 0;
-3
drivers/i2c/busses/i2c-at91.h
··· 157 157 struct at91_twi_dma dma; 158 158 bool slave_detected; 159 159 struct i2c_bus_recovery_info rinfo; 160 - struct pinctrl *pinctrl; 161 - struct pinctrl_state *pinctrl_pins_default; 162 - struct pinctrl_state *pinctrl_pins_gpio; 163 160 #ifdef CONFIG_I2C_AT91_SLAVE_EXPERIMENTAL 164 161 unsigned smr; 165 162 struct i2c_client *slave;
+12 -1
drivers/i2c/busses/i2c-bcm-iproc.c
··· 1078 1078 if (!iproc_i2c->slave) 1079 1079 return -EINVAL; 1080 1080 1081 - iproc_i2c->slave = NULL; 1081 + disable_irq(iproc_i2c->irq); 1082 1082 1083 1083 /* disable all slave interrupts */ 1084 1084 tmp = iproc_i2c_rd_reg(iproc_i2c, IE_OFFSET); ··· 1090 1090 tmp = iproc_i2c_rd_reg(iproc_i2c, S_CFG_SMBUS_ADDR_OFFSET); 1091 1091 tmp &= ~BIT(S_CFG_EN_NIC_SMB_ADDR3_SHIFT); 1092 1092 iproc_i2c_wr_reg(iproc_i2c, S_CFG_SMBUS_ADDR_OFFSET, tmp); 1093 + 1094 + /* flush TX/RX FIFOs */ 1095 + tmp = (BIT(S_FIFO_RX_FLUSH_SHIFT) | BIT(S_FIFO_TX_FLUSH_SHIFT)); 1096 + iproc_i2c_wr_reg(iproc_i2c, S_FIFO_CTRL_OFFSET, tmp); 1097 + 1098 + /* clear all pending slave interrupts */ 1099 + iproc_i2c_wr_reg(iproc_i2c, IS_OFFSET, ISR_MASK_SLAVE); 1100 + 1101 + iproc_i2c->slave = NULL; 1102 + 1103 + enable_irq(iproc_i2c->irq); 1093 1104 1094 1105 return 0; 1095 1106 }
+1 -1
drivers/i2c/busses/i2c-bcm2835.c
··· 392 392 393 393 /* 394 394 * The BCM2835 was reported to have problems with clock stretching: 395 - * http://www.advamation.com/knowhow/raspberrypi/rpi-i2c-bug.html 395 + * https://www.advamation.com/knowhow/raspberrypi/rpi-i2c-bug.html 396 396 * https://www.raspberrypi.org/forums/viewtopic.php?p=146272 397 397 */ 398 398 static const struct i2c_adapter_quirks bcm2835_i2c_quirks = {
+1 -1
drivers/i2c/busses/i2c-designware-pcidrv.c
··· 90 90 switch (pdev->device) { 91 91 case 0x0817: 92 92 dev->timings.bus_freq_hz = I2C_MAX_STANDARD_MODE_FREQ; 93 - /* fall through */ 93 + fallthrough; 94 94 case 0x0818: 95 95 case 0x0819: 96 96 c->bus_num = pdev->device - 0x817 + 3;
+1 -1
drivers/i2c/busses/i2c-digicolor.c
··· 187 187 break; 188 188 } 189 189 i2c->state = STATE_WRITE; 190 - /* fall through */ 190 + fallthrough; 191 191 case STATE_WRITE: 192 192 if (i2c->msgbuf_ptr < i2c->msg->len) 193 193 dc_i2c_write_buf(i2c);
+7 -32
drivers/i2c/busses/i2c-eg20t.c
··· 846 846 kfree(adap_info); 847 847 } 848 848 849 - #ifdef CONFIG_PM 850 - static int pch_i2c_suspend(struct pci_dev *pdev, pm_message_t state) 849 + static int __maybe_unused pch_i2c_suspend(struct device *dev) 851 850 { 852 - int ret; 853 851 int i; 852 + struct pci_dev *pdev = to_pci_dev(dev); 854 853 struct adapter_info *adap_info = pci_get_drvdata(pdev); 855 854 void __iomem *p = adap_info->pch_data[0].pch_base_address; 856 855 ··· 871 872 ioread32(p + PCH_I2CSR), ioread32(p + PCH_I2CBUFSTA), 872 873 ioread32(p + PCH_I2CESRSTA)); 873 874 874 - ret = pci_save_state(pdev); 875 - 876 - if (ret) { 877 - pch_pci_err(pdev, "pci_save_state\n"); 878 - return ret; 879 - } 880 - 881 - pci_enable_wake(pdev, PCI_D3hot, 0); 882 - pci_disable_device(pdev); 883 - pci_set_power_state(pdev, pci_choose_state(pdev, state)); 884 - 885 875 return 0; 886 876 } 887 877 888 - static int pch_i2c_resume(struct pci_dev *pdev) 878 + static int __maybe_unused pch_i2c_resume(struct device *dev) 889 879 { 890 880 int i; 891 - struct adapter_info *adap_info = pci_get_drvdata(pdev); 892 - 893 - pci_set_power_state(pdev, PCI_D0); 894 - pci_restore_state(pdev); 895 - 896 - if (pci_enable_device(pdev) < 0) { 897 - pch_pci_err(pdev, "pch_i2c_resume:pci_enable_device FAILED\n"); 898 - return -EIO; 899 - } 900 - 901 - pci_enable_wake(pdev, PCI_D3hot, 0); 881 + struct adapter_info *adap_info = dev_get_drvdata(dev); 902 882 903 883 for (i = 0; i < adap_info->ch_num; i++) 904 884 pch_i2c_init(&adap_info->pch_data[i]); ··· 886 908 887 909 return 0; 888 910 } 889 - #else 890 - #define pch_i2c_suspend NULL 891 - #define pch_i2c_resume NULL 892 - #endif 911 + 912 + static SIMPLE_DEV_PM_OPS(pch_i2c_pm_ops, pch_i2c_suspend, pch_i2c_resume); 893 913 894 914 static struct pci_driver pch_pcidriver = { 895 915 .name = KBUILD_MODNAME, 896 916 .id_table = pch_pcidev_id, 897 917 .probe = pch_i2c_probe, 898 918 .remove = pch_i2c_remove, 899 - .suspend = pch_i2c_suspend, 900 - .resume = pch_i2c_resume 919 + .driver.pm = &pch_i2c_pm_ops, 901 920 }; 902 921 903 922 module_pci_driver(pch_pcidriver);
+2 -1
drivers/i2c/busses/i2c-emev2.c
··· 442 442 module_platform_driver(em_i2c_driver); 443 443 444 444 MODULE_DESCRIPTION("EMEV2 I2C bus driver"); 445 - MODULE_AUTHOR("Ian Molton and Wolfram Sang <wsa@sang-engineering.com>"); 445 + MODULE_AUTHOR("Ian Molton"); 446 + MODULE_AUTHOR("Wolfram Sang <wsa@sang-engineering.com>"); 446 447 MODULE_LICENSE("GPL v2"); 447 448 MODULE_DEVICE_TABLE(of, em_i2c_ids);
+1 -1
drivers/i2c/busses/i2c-fsi.c
··· 703 703 704 704 for (port_no = 0; port_no < ports; port_no++) { 705 705 np = fsi_i2c_find_port_of_node(dev->of_node, port_no); 706 - if (np && !of_device_is_available(np)) 706 + if (!of_device_is_available(np)) 707 707 continue; 708 708 709 709 port = kzalloc(sizeof(*port), GFP_KERNEL);
+14 -5
drivers/i2c/busses/i2c-i801.c
··· 54 54 * Sunrise Point-H (PCH) 0xa123 32 hard yes yes yes 55 55 * Sunrise Point-LP (PCH) 0x9d23 32 hard yes yes yes 56 56 * DNV (SOC) 0x19df 32 hard yes yes yes 57 + * Emmitsburg (PCH) 0x1bc9 32 hard yes yes yes 57 58 * Broxton (SOC) 0x5ad4 32 hard yes yes yes 58 59 * Lewisburg (PCH) 0xa1a3 32 hard yes yes yes 59 60 * Lewisburg Supersku (PCH) 0xa223 32 hard yes yes yes ··· 68 67 * Comet Lake-H (PCH) 0x06a3 32 hard yes yes yes 69 68 * Elkhart Lake (PCH) 0x4b23 32 hard yes yes yes 70 69 * Tiger Lake-LP (PCH) 0xa0a3 32 hard yes yes yes 70 + * Tiger Lake-H (PCH) 0x43a3 32 hard yes yes yes 71 71 * Jasper Lake (SOC) 0x4da3 32 hard yes yes yes 72 72 * Comet Lake-V (PCH) 0xa3a3 32 hard yes yes yes 73 73 * ··· 209 207 #define PCI_DEVICE_ID_INTEL_BAYTRAIL_SMBUS 0x0f12 210 208 #define PCI_DEVICE_ID_INTEL_CDF_SMBUS 0x18df 211 209 #define PCI_DEVICE_ID_INTEL_DNV_SMBUS 0x19df 210 + #define PCI_DEVICE_ID_INTEL_EBG_SMBUS 0x1bc9 212 211 #define PCI_DEVICE_ID_INTEL_COUGARPOINT_SMBUS 0x1c22 213 212 #define PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS 0x1d22 214 213 /* Patsburg also has three 'Integrated Device Function' SMBus controllers */ ··· 224 221 #define PCI_DEVICE_ID_INTEL_GEMINILAKE_SMBUS 0x31d4 225 222 #define PCI_DEVICE_ID_INTEL_ICELAKE_LP_SMBUS 0x34a3 226 223 #define PCI_DEVICE_ID_INTEL_5_3400_SERIES_SMBUS 0x3b30 224 + #define PCI_DEVICE_ID_INTEL_TIGERLAKE_H_SMBUS 0x43a3 227 225 #define PCI_DEVICE_ID_INTEL_ELKHART_LAKE_SMBUS 0x4b23 228 226 #define PCI_DEVICE_ID_INTEL_JASPER_LAKE_SMBUS 0x4da3 229 227 #define PCI_DEVICE_ID_INTEL_BROXTON_SMBUS 0x5ad4 ··· 1066 1062 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_SMBUS) }, 1067 1063 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CDF_SMBUS) }, 1068 1064 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_DNV_SMBUS) }, 1065 + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_EBG_SMBUS) }, 1069 1066 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BROXTON_SMBUS) }, 1070 1067 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_LEWISBURG_SMBUS) }, 1071 1068 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_LEWISBURG_SSKU_SMBUS) }, ··· 1079 1074 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_COMETLAKE_V_SMBUS) }, 1080 1075 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ELKHART_LAKE_SMBUS) }, 1081 1076 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_TIGERLAKE_LP_SMBUS) }, 1077 + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_TIGERLAKE_H_SMBUS) }, 1082 1078 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_JASPER_LAKE_SMBUS) }, 1083 1079 { 0, } 1084 1080 }; ··· 1754 1748 case PCI_DEVICE_ID_INTEL_COMETLAKE_H_SMBUS: 1755 1749 case PCI_DEVICE_ID_INTEL_ELKHART_LAKE_SMBUS: 1756 1750 case PCI_DEVICE_ID_INTEL_TIGERLAKE_LP_SMBUS: 1751 + case PCI_DEVICE_ID_INTEL_TIGERLAKE_H_SMBUS: 1757 1752 case PCI_DEVICE_ID_INTEL_JASPER_LAKE_SMBUS: 1753 + case PCI_DEVICE_ID_INTEL_EBG_SMBUS: 1758 1754 priv->features |= FEATURE_BLOCK_PROC; 1759 1755 priv->features |= FEATURE_I2C_BLOCK_READ; 1760 1756 priv->features |= FEATURE_IRQ; ··· 1773 1765 case PCI_DEVICE_ID_INTEL_WELLSBURG_SMBUS_MS1: 1774 1766 case PCI_DEVICE_ID_INTEL_WELLSBURG_SMBUS_MS2: 1775 1767 priv->features |= FEATURE_IDF; 1776 - /* fall through */ 1768 + fallthrough; 1777 1769 default: 1778 1770 priv->features |= FEATURE_BLOCK_PROC; 1779 1771 priv->features |= FEATURE_I2C_BLOCK_READ; 1780 1772 priv->features |= FEATURE_IRQ; 1781 - /* fall through */ 1773 + fallthrough; 1782 1774 case PCI_DEVICE_ID_INTEL_82801DB_3: 1783 1775 priv->features |= FEATURE_SMBUS_PEC; 1784 1776 priv->features |= FEATURE_BLOCK_BUFFER; 1785 - /* fall through */ 1777 + fallthrough; 1786 1778 case PCI_DEVICE_ID_INTEL_82801CA_3: 1787 1779 priv->features |= FEATURE_HOST_NOTIFY; 1788 - /* fall through */ 1780 + fallthrough; 1789 1781 case PCI_DEVICE_ID_INTEL_82801BA_2: 1790 1782 case PCI_DEVICE_ID_INTEL_82801AB_3: 1791 1783 case PCI_DEVICE_ID_INTEL_82801AA_3: ··· 1994 1986 pci_unregister_driver(&i801_driver); 1995 1987 } 1996 1988 1997 - MODULE_AUTHOR("Mark D. Studebaker <mdsxyz123@yahoo.com>, Jean Delvare <jdelvare@suse.de>"); 1989 + MODULE_AUTHOR("Mark D. Studebaker <mdsxyz123@yahoo.com>"); 1990 + MODULE_AUTHOR("Jean Delvare <jdelvare@suse.de>"); 1998 1991 MODULE_DESCRIPTION("I801 SMBus driver"); 1999 1992 MODULE_LICENSE("GPL"); 2000 1993
+56 -30
drivers/i2c/busses/i2c-mt65xx.c
··· 48 48 49 49 #define I2C_DMA_CON_TX 0x0000 50 50 #define I2C_DMA_CON_RX 0x0001 51 + #define I2C_DMA_ASYNC_MODE 0x0004 52 + #define I2C_DMA_SKIP_CONFIG 0x0010 53 + #define I2C_DMA_DIR_CHANGE 0x0200 51 54 #define I2C_DMA_START_EN 0x0001 52 55 #define I2C_DMA_INT_FLAG_NONE 0x0000 53 56 #define I2C_DMA_CLR_FLAG 0x0000 54 57 #define I2C_DMA_HARD_RST 0x0002 55 - #define I2C_DMA_4G_MODE 0x0001 56 58 57 59 #define MAX_SAMPLE_CNT_DIV 8 58 60 #define MAX_STEP_CNT_DIV 64 ··· 203 201 unsigned char dcm: 1; 204 202 unsigned char auto_restart: 1; 205 203 unsigned char aux_len_reg: 1; 206 - unsigned char support_33bits: 1; 207 204 unsigned char timing_adjust: 1; 208 205 unsigned char dma_sync: 1; 209 206 unsigned char ltiming_adjust: 1; 207 + unsigned char apdma_sync: 1; 208 + unsigned char max_dma_support; 210 209 }; 211 210 212 211 struct mtk_i2c_ac_timing { ··· 253 250 254 251 /** 255 252 * struct i2c_spec_values: 256 - * min_low_ns: min LOW period of the SCL clock 257 - * min_su_sta_ns: min set-up time for a repeated START condition 258 - * max_hd_dat_ns: max data hold time 259 - * min_su_dat_ns: min data set-up time 253 + * @min_low_ns: min LOW period of the SCL clock 254 + * @min_su_sta_ns: min set-up time for a repeated START condition 255 + * @max_hd_dat_ns: max data hold time 256 + * @min_su_dat_ns: min data set-up time 260 257 */ 261 258 struct i2c_spec_values { 262 259 unsigned int min_low_ns; 263 - unsigned int min_high_ns; 264 260 unsigned int min_su_sta_ns; 265 261 unsigned int max_hd_dat_ns; 266 262 unsigned int min_su_dat_ns; ··· 309 307 .dcm = 1, 310 308 .auto_restart = 1, 311 309 .aux_len_reg = 1, 312 - .support_33bits = 1, 313 310 .timing_adjust = 1, 314 311 .dma_sync = 0, 315 312 .ltiming_adjust = 0, 313 + .apdma_sync = 0, 314 + .max_dma_support = 33, 316 315 }; 317 316 318 317 static const struct mtk_i2c_compatible mt6577_compat = { ··· 323 320 .dcm = 1, 324 321 .auto_restart = 0, 325 322 .aux_len_reg = 0, 326 - .support_33bits = 0, 327 323 .timing_adjust = 0, 328 324 .dma_sync = 0, 329 325 .ltiming_adjust = 0, 326 + .apdma_sync = 0, 327 + .max_dma_support = 32, 330 328 }; 331 329 332 330 static const struct mtk_i2c_compatible mt6589_compat = { ··· 337 333 .dcm = 0, 338 334 .auto_restart = 0, 339 335 .aux_len_reg = 0, 340 - .support_33bits = 0, 341 336 .timing_adjust = 0, 342 337 .dma_sync = 0, 343 338 .ltiming_adjust = 0, 339 + .apdma_sync = 0, 340 + .max_dma_support = 32, 344 341 }; 345 342 346 343 static const struct mtk_i2c_compatible mt7622_compat = { ··· 351 346 .dcm = 1, 352 347 .auto_restart = 1, 353 348 .aux_len_reg = 1, 354 - .support_33bits = 0, 355 349 .timing_adjust = 0, 356 350 .dma_sync = 0, 357 351 .ltiming_adjust = 0, 352 + .apdma_sync = 0, 353 + .max_dma_support = 32, 358 354 }; 359 355 360 356 static const struct mtk_i2c_compatible mt8173_compat = { ··· 364 358 .dcm = 1, 365 359 .auto_restart = 1, 366 360 .aux_len_reg = 1, 367 - .support_33bits = 1, 368 361 .timing_adjust = 0, 369 362 .dma_sync = 0, 370 363 .ltiming_adjust = 0, 364 + .apdma_sync = 0, 365 + .max_dma_support = 33, 371 366 }; 372 367 373 368 static const struct mtk_i2c_compatible mt8183_compat = { ··· 378 371 .dcm = 0, 379 372 .auto_restart = 1, 380 373 .aux_len_reg = 1, 381 - .support_33bits = 1, 382 374 .timing_adjust = 1, 383 375 .dma_sync = 1, 384 376 .ltiming_adjust = 1, 377 + .apdma_sync = 0, 378 + .max_dma_support = 33, 379 + }; 380 + 381 + static const struct mtk_i2c_compatible mt8192_compat = { 382 + .quirks = &mt8183_i2c_quirks, 383 + .regs = mt_i2c_regs_v2, 384 + .pmic_i2c = 0, 385 + .dcm = 0, 386 + .auto_restart = 1, 387 + .aux_len_reg = 1, 388 + .timing_adjust = 1, 389 + .dma_sync = 1, 390 + .ltiming_adjust = 1, 391 + .apdma_sync = 1, 392 + .max_dma_support = 36, 385 393 }; 386 394 387 395 static const struct of_device_id mtk_i2c_of_match[] = { ··· 406 384 { .compatible = "mediatek,mt7622-i2c", .data = &mt7622_compat }, 407 385 { .compatible = "mediatek,mt8173-i2c", .data = &mt8173_compat }, 408 386 { .compatible = "mediatek,mt8183-i2c", .data = &mt8183_compat }, 387 + { .compatible = "mediatek,mt8192-i2c", .data = &mt8192_compat }, 409 388 {} 410 389 }; 411 390 MODULE_DEVICE_TABLE(of, mtk_i2c_of_match); ··· 809 786 return 0; 810 787 } 811 788 812 - static inline u32 mtk_i2c_set_4g_mode(dma_addr_t addr) 813 - { 814 - return (addr & BIT_ULL(32)) ? I2C_DMA_4G_MODE : I2C_DMA_CLR_FLAG; 815 - } 816 - 817 789 static int mtk_i2c_do_transfer(struct mtk_i2c *i2c, struct i2c_msg *msgs, 818 790 int num, int left_num) 819 791 { ··· 816 798 u16 start_reg; 817 799 u16 control_reg; 818 800 u16 restart_flag = 0; 801 + u16 dma_sync = 0; 819 802 u32 reg_4g_mode; 820 803 u8 *dma_rd_buf = NULL; 821 804 u8 *dma_wr_buf = NULL; ··· 870 851 mtk_i2c_writew(i2c, num, OFFSET_TRANSAC_LEN); 871 852 } 872 853 854 + if (i2c->dev_comp->apdma_sync) { 855 + dma_sync = I2C_DMA_SKIP_CONFIG | I2C_DMA_ASYNC_MODE; 856 + if (i2c->op == I2C_MASTER_WRRD) 857 + dma_sync |= I2C_DMA_DIR_CHANGE; 858 + } 859 + 873 860 /* Prepare buffer data to start transfer */ 874 861 if (i2c->op == I2C_MASTER_RD) { 875 862 writel(I2C_DMA_INT_FLAG_NONE, i2c->pdmabase + OFFSET_INT_FLAG); 876 - writel(I2C_DMA_CON_RX, i2c->pdmabase + OFFSET_CON); 863 + writel(I2C_DMA_CON_RX | dma_sync, i2c->pdmabase + OFFSET_CON); 877 864 878 865 dma_rd_buf = i2c_get_dma_safe_msg_buf(msgs, 1); 879 866 if (!dma_rd_buf) ··· 893 868 return -ENOMEM; 894 869 } 895 870 896 - if (i2c->dev_comp->support_33bits) { 897 - reg_4g_mode = mtk_i2c_set_4g_mode(rpaddr); 871 + if (i2c->dev_comp->max_dma_support > 32) { 872 + reg_4g_mode = upper_32_bits(rpaddr); 898 873 writel(reg_4g_mode, i2c->pdmabase + OFFSET_RX_4G_MODE); 899 874 } 900 875 ··· 902 877 writel(msgs->len, i2c->pdmabase + OFFSET_RX_LEN); 903 878 } else if (i2c->op == I2C_MASTER_WR) { 904 879 writel(I2C_DMA_INT_FLAG_NONE, i2c->pdmabase + OFFSET_INT_FLAG); 905 - writel(I2C_DMA_CON_TX, i2c->pdmabase + OFFSET_CON); 880 + writel(I2C_DMA_CON_TX | dma_sync, i2c->pdmabase + OFFSET_CON); 906 881 907 882 dma_wr_buf = i2c_get_dma_safe_msg_buf(msgs, 1); 908 883 if (!dma_wr_buf) ··· 916 891 return -ENOMEM; 917 892 } 918 893 919 - if (i2c->dev_comp->support_33bits) { 920 - reg_4g_mode = mtk_i2c_set_4g_mode(wpaddr); 894 + if (i2c->dev_comp->max_dma_support > 32) { 895 + reg_4g_mode = upper_32_bits(wpaddr); 921 896 writel(reg_4g_mode, i2c->pdmabase + OFFSET_TX_4G_MODE); 922 897 } 923 898 ··· 925 900 writel(msgs->len, i2c->pdmabase + OFFSET_TX_LEN); 926 901 } else { 927 902 writel(I2C_DMA_CLR_FLAG, i2c->pdmabase + OFFSET_INT_FLAG); 928 - writel(I2C_DMA_CLR_FLAG, i2c->pdmabase + OFFSET_CON); 903 + writel(I2C_DMA_CLR_FLAG | dma_sync, i2c->pdmabase + OFFSET_CON); 929 904 930 905 dma_wr_buf = i2c_get_dma_safe_msg_buf(msgs, 1); 931 906 if (!dma_wr_buf) ··· 962 937 return -ENOMEM; 963 938 } 964 939 965 - if (i2c->dev_comp->support_33bits) { 966 - reg_4g_mode = mtk_i2c_set_4g_mode(wpaddr); 940 + if (i2c->dev_comp->max_dma_support > 32) { 941 + reg_4g_mode = upper_32_bits(wpaddr); 967 942 writel(reg_4g_mode, i2c->pdmabase + OFFSET_TX_4G_MODE); 968 943 969 - reg_4g_mode = mtk_i2c_set_4g_mode(rpaddr); 944 + reg_4g_mode = upper_32_bits(rpaddr); 970 945 writel(reg_4g_mode, i2c->pdmabase + OFFSET_RX_4G_MODE); 971 946 } 972 947 ··· 1240 1215 return -EINVAL; 1241 1216 } 1242 1217 1243 - if (i2c->dev_comp->support_33bits) { 1244 - ret = dma_set_mask(&pdev->dev, DMA_BIT_MASK(33)); 1218 + if (i2c->dev_comp->max_dma_support > 32) { 1219 + ret = dma_set_mask(&pdev->dev, 1220 + DMA_BIT_MASK(i2c->dev_comp->max_dma_support)); 1245 1221 if (ret) { 1246 1222 dev_err(&pdev->dev, "dma_set_mask return error.\n"); 1247 1223 return ret;
+4 -5
drivers/i2c/busses/i2c-mv64xxx.c
··· 251 251 MV64XXX_I2C_STATE_WAITING_FOR_ADDR_2_ACK; 252 252 break; 253 253 } 254 - /* FALLTHRU */ 254 + fallthrough; 255 255 case MV64XXX_I2C_STATUS_MAST_WR_ADDR_2_ACK: /* 0xd0 */ 256 256 case MV64XXX_I2C_STATUS_MAST_WR_ACK: /* 0x28 */ 257 257 if ((drv_data->bytes_left == 0) ··· 282 282 MV64XXX_I2C_STATE_WAITING_FOR_ADDR_2_ACK; 283 283 break; 284 284 } 285 - /* FALLTHRU */ 285 + fallthrough; 286 286 case MV64XXX_I2C_STATUS_MAST_RD_ADDR_2_ACK: /* 0xe0 */ 287 287 if (drv_data->bytes_left == 0) { 288 288 drv_data->action = MV64XXX_I2C_ACTION_SEND_STOP; 289 289 drv_data->state = MV64XXX_I2C_STATE_IDLE; 290 290 break; 291 291 } 292 - /* FALLTHRU */ 292 + fallthrough; 293 293 case MV64XXX_I2C_STATUS_MAST_RD_DATA_ACK: /* 0x50 */ 294 294 if (status != MV64XXX_I2C_STATUS_MAST_RD_DATA_ACK) 295 295 drv_data->action = MV64XXX_I2C_ACTION_CONTINUE; ··· 417 417 "mv64xxx_i2c_do_action: Invalid action: %d\n", 418 418 drv_data->action); 419 419 drv_data->rc = -EIO; 420 - 421 - /* FALLTHRU */ 420 + fallthrough; 422 421 case MV64XXX_I2C_ACTION_SEND_STOP: 423 422 drv_data->cntl_bits &= ~MV64XXX_I2C_REG_CONTROL_INTEN; 424 423 writel(drv_data->cntl_bits | MV64XXX_I2C_REG_CONTROL_STOP,
+2 -1
drivers/i2c/busses/i2c-nomadik.c
··· 1122 1122 subsys_initcall(nmk_i2c_init); 1123 1123 module_exit(nmk_i2c_exit); 1124 1124 1125 - MODULE_AUTHOR("Sachin Verma, Srinidhi KASAGAR"); 1125 + MODULE_AUTHOR("Sachin Verma"); 1126 + MODULE_AUTHOR("Srinidhi KASAGAR"); 1126 1127 MODULE_DESCRIPTION("Nomadik/Ux500 I2C driver"); 1127 1128 MODULE_LICENSE("GPL");
+2 -2
drivers/i2c/busses/i2c-piix4.c
··· 1032 1032 1033 1033 module_pci_driver(piix4_driver); 1034 1034 1035 - MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl> and " 1036 - "Philip Edelbrock <phil@netroedge.com>"); 1035 + MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl>"); 1036 + MODULE_AUTHOR("Philip Edelbrock <phil@netroedge.com>"); 1037 1037 MODULE_DESCRIPTION("PIIX4 SMBus driver"); 1038 1038 MODULE_LICENSE("GPL");
+2 -1
drivers/i2c/busses/i2c-pnx.c
··· 781 781 platform_driver_unregister(&i2c_pnx_driver); 782 782 } 783 783 784 - MODULE_AUTHOR("Vitaly Wool, Dennis Kovalev <source@mvista.com>"); 784 + MODULE_AUTHOR("Vitaly Wool"); 785 + MODULE_AUTHOR("Dennis Kovalev <source@mvista.com>"); 785 786 MODULE_DESCRIPTION("I2C driver for Philips IP3204-based I2C busses"); 786 787 MODULE_LICENSE("GPL"); 787 788 MODULE_ALIAS("platform:pnx-i2c");
+9 -6
drivers/i2c/busses/i2c-rcar.c
··· 583 583 rcar_i2c_write(priv, ICSIER, SDR | SSR | SAR); 584 584 } 585 585 586 - rcar_i2c_write(priv, ICSSR, ~SAR & 0xff); 586 + /* Clear SSR, too, because of old STOPs to other clients than us */ 587 + rcar_i2c_write(priv, ICSSR, ~(SAR | SSR) & 0xff); 587 588 } 588 589 589 590 /* master sent stop */ 590 591 if (ssr_filtered & SSR) { 591 592 i2c_slave_event(priv->slave, I2C_SLAVE_STOP, &value); 592 - rcar_i2c_write(priv, ICSIER, SAR | SSR); 593 + rcar_i2c_write(priv, ICSIER, SAR); 593 594 rcar_i2c_write(priv, ICSSR, ~SSR & 0xff); 594 595 } 595 596 ··· 854 853 priv->slave = slave; 855 854 rcar_i2c_write(priv, ICSAR, slave->addr); 856 855 rcar_i2c_write(priv, ICSSR, 0); 857 - rcar_i2c_write(priv, ICSIER, SAR | SSR); 856 + rcar_i2c_write(priv, ICSIER, SAR); 858 857 rcar_i2c_write(priv, ICSCR, SIE | SDBS); 859 858 860 859 return 0; ··· 866 865 867 866 WARN_ON(!priv->slave); 868 867 869 - /* disable irqs and ensure none is running before clearing ptr */ 868 + /* ensure no irq is running before clearing ptr */ 869 + disable_irq(priv->irq); 870 870 rcar_i2c_write(priv, ICSIER, 0); 871 - rcar_i2c_write(priv, ICSCR, 0); 871 + rcar_i2c_write(priv, ICSSR, 0); 872 + enable_irq(priv->irq); 873 + rcar_i2c_write(priv, ICSCR, SDBS); 872 874 rcar_i2c_write(priv, ICSAR, 0); /* Gen2: must be 0 if not using slave */ 873 875 874 - synchronize_irq(priv->irq); 875 876 priv->slave = NULL; 876 877 877 878 pm_runtime_put(rcar_i2c_priv_to_dev(priv));
+35 -4
drivers/i2c/busses/i2c-rk3x.c
··· 10 10 #include <linux/module.h> 11 11 #include <linux/i2c.h> 12 12 #include <linux/interrupt.h> 13 + #include <linux/iopoll.h> 13 14 #include <linux/errno.h> 14 15 #include <linux/err.h> 15 16 #include <linux/platform_device.h> ··· 1041 1040 return ret; 1042 1041 } 1043 1042 1044 - static int rk3x_i2c_xfer(struct i2c_adapter *adap, 1045 - struct i2c_msg *msgs, int num) 1043 + static int rk3x_i2c_wait_xfer_poll(struct rk3x_i2c *i2c) 1044 + { 1045 + ktime_t timeout = ktime_add_ms(ktime_get(), WAIT_TIMEOUT); 1046 + 1047 + while (READ_ONCE(i2c->busy) && 1048 + ktime_compare(ktime_get(), timeout) < 0) { 1049 + udelay(5); 1050 + rk3x_i2c_irq(0, i2c); 1051 + } 1052 + 1053 + return !i2c->busy; 1054 + } 1055 + 1056 + static int rk3x_i2c_xfer_common(struct i2c_adapter *adap, 1057 + struct i2c_msg *msgs, int num, bool polling) 1046 1058 { 1047 1059 struct rk3x_i2c *i2c = (struct rk3x_i2c *)adap->algo_data; 1048 1060 unsigned long timeout, flags; ··· 1089 1075 1090 1076 rk3x_i2c_start(i2c); 1091 1077 1092 - timeout = wait_event_timeout(i2c->wait, !i2c->busy, 1093 - msecs_to_jiffies(WAIT_TIMEOUT)); 1078 + if (!polling) { 1079 + timeout = wait_event_timeout(i2c->wait, !i2c->busy, 1080 + msecs_to_jiffies(WAIT_TIMEOUT)); 1081 + } else { 1082 + timeout = rk3x_i2c_wait_xfer_poll(i2c); 1083 + } 1094 1084 1095 1085 spin_lock_irqsave(&i2c->lock, flags); 1096 1086 ··· 1128 1110 return ret < 0 ? ret : num; 1129 1111 } 1130 1112 1113 + static int rk3x_i2c_xfer(struct i2c_adapter *adap, 1114 + struct i2c_msg *msgs, int num) 1115 + { 1116 + return rk3x_i2c_xfer_common(adap, msgs, num, false); 1117 + } 1118 + 1119 + static int rk3x_i2c_xfer_polling(struct i2c_adapter *adap, 1120 + struct i2c_msg *msgs, int num) 1121 + { 1122 + return rk3x_i2c_xfer_common(adap, msgs, num, true); 1123 + } 1124 + 1131 1125 static __maybe_unused int rk3x_i2c_resume(struct device *dev) 1132 1126 { 1133 1127 struct rk3x_i2c *i2c = dev_get_drvdata(dev); ··· 1156 1126 1157 1127 static const struct i2c_algorithm rk3x_i2c_algorithm = { 1158 1128 .master_xfer = rk3x_i2c_xfer, 1129 + .master_xfer_atomic = rk3x_i2c_xfer_polling, 1159 1130 .functionality = rk3x_i2c_func, 1160 1131 }; 1161 1132
+2 -1
drivers/i2c/busses/i2c-sh_mobile.c
··· 932 932 module_exit(sh_mobile_i2c_adap_exit); 933 933 934 934 MODULE_DESCRIPTION("SuperH Mobile I2C Bus Controller driver"); 935 - MODULE_AUTHOR("Magnus Damm and Wolfram Sang"); 935 + MODULE_AUTHOR("Magnus Damm"); 936 + MODULE_AUTHOR("Wolfram Sang"); 936 937 MODULE_LICENSE("GPL v2"); 937 938 MODULE_ALIAS("platform:i2c-sh_mobile");
+2 -1
drivers/i2c/busses/i2c-sibyte.c
··· 180 180 module_init(i2c_sibyte_init); 181 181 module_exit(i2c_sibyte_exit); 182 182 183 - MODULE_AUTHOR("Kip Walker (Broadcom Corp.), Steven J. Hill <sjhill@realitydiluted.com>"); 183 + MODULE_AUTHOR("Kip Walker (Broadcom Corp.)"); 184 + MODULE_AUTHOR("Steven J. Hill <sjhill@realitydiluted.com>"); 184 185 MODULE_DESCRIPTION("SMBus adapter routines for SiByte boards"); 185 186 MODULE_LICENSE("GPL");
+2 -2
drivers/i2c/busses/i2c-sirf.c
··· 470 470 module_platform_driver(i2c_sirfsoc_driver); 471 471 472 472 MODULE_DESCRIPTION("SiRF SoC I2C master controller driver"); 473 - MODULE_AUTHOR("Zhiwu Song <Zhiwu.Song@csr.com>, " 474 - "Xiangzhen Ye <Xiangzhen.Ye@csr.com>"); 473 + MODULE_AUTHOR("Zhiwu Song <Zhiwu.Song@csr.com>"); 474 + MODULE_AUTHOR("Xiangzhen Ye <Xiangzhen.Ye@csr.com>"); 475 475 MODULE_LICENSE("GPL v2");
+1 -2
drivers/i2c/busses/i2c-synquacer.c
··· 398 398 399 399 if (i2c->state == STATE_READ) 400 400 goto prepare_read; 401 - 402 - /* fall through */ 401 + fallthrough; 403 402 404 403 case STATE_WRITE: 405 404 if (bsr & SYNQUACER_I2C_BSR_LRB) {
+56 -45
drivers/i2c/busses/i2c-tegra.c
··· 293 293 bool is_curr_atomic_xfer; 294 294 }; 295 295 296 + static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev, bool clk_reinit); 297 + 296 298 static void dvc_writel(struct tegra_i2c_dev *i2c_dev, u32 val, 297 299 unsigned long reg) 298 300 { ··· 421 419 dma_addr_t dma_phys; 422 420 int err; 423 421 424 - if (!i2c_dev->hw->has_apb_dma) 422 + if (!i2c_dev->hw->has_apb_dma || i2c_dev->is_vi) 425 423 return 0; 426 424 427 425 if (!IS_ENABLED(CONFIG_TEGRA20_APB_DMA)) { ··· 657 655 if (ret) 658 656 return ret; 659 657 660 - if (!i2c_dev->hw->has_single_clk_source) { 661 - ret = clk_enable(i2c_dev->fast_clk); 662 - if (ret < 0) { 663 - dev_err(i2c_dev->dev, 664 - "Enabling fast clk failed, err %d\n", ret); 665 - return ret; 666 - } 658 + ret = clk_enable(i2c_dev->fast_clk); 659 + if (ret < 0) { 660 + dev_err(i2c_dev->dev, 661 + "Enabling fast clk failed, err %d\n", ret); 662 + return ret; 667 663 } 668 664 669 - if (i2c_dev->slow_clk) { 670 - ret = clk_enable(i2c_dev->slow_clk); 671 - if (ret < 0) { 672 - dev_err(dev, "failed to enable slow clock: %d\n", ret); 673 - return ret; 674 - } 665 + ret = clk_enable(i2c_dev->slow_clk); 666 + if (ret < 0) { 667 + dev_err(dev, "failed to enable slow clock: %d\n", ret); 668 + goto disable_fast_clk; 675 669 } 676 670 677 671 ret = clk_enable(i2c_dev->div_clk); 678 672 if (ret < 0) { 679 673 dev_err(i2c_dev->dev, 680 674 "Enabling div clk failed, err %d\n", ret); 681 - clk_disable(i2c_dev->fast_clk); 682 - return ret; 675 + goto disable_slow_clk; 676 + } 677 + 678 + /* 679 + * VI I2C device is attached to VE power domain which goes through 680 + * power ON/OFF during PM runtime resume/suspend. So, controller 681 + * should go through reset and need to re-initialize after power 682 + * domain ON. 683 + */ 684 + if (i2c_dev->is_vi) { 685 + ret = tegra_i2c_init(i2c_dev, true); 686 + if (ret) 687 + goto disable_div_clk; 683 688 } 684 689 685 690 return 0; 691 + 692 + disable_div_clk: 693 + clk_disable(i2c_dev->div_clk); 694 + disable_slow_clk: 695 + clk_disable(i2c_dev->slow_clk); 696 + disable_fast_clk: 697 + clk_disable(i2c_dev->fast_clk); 698 + return ret; 686 699 } 687 700 688 701 static int __maybe_unused tegra_i2c_runtime_suspend(struct device *dev) ··· 705 688 struct tegra_i2c_dev *i2c_dev = dev_get_drvdata(dev); 706 689 707 690 clk_disable(i2c_dev->div_clk); 708 - 709 - if (i2c_dev->slow_clk) 710 - clk_disable(i2c_dev->slow_clk); 711 - 712 - if (!i2c_dev->hw->has_single_clk_source) 713 - clk_disable(i2c_dev->fast_clk); 691 + clk_disable(i2c_dev->slow_clk); 692 + clk_disable(i2c_dev->fast_clk); 714 693 715 694 return pinctrl_pm_select_idle_state(i2c_dev->dev); 716 695 } ··· 1729 1716 1730 1717 platform_set_drvdata(pdev, i2c_dev); 1731 1718 1732 - if (!i2c_dev->hw->has_single_clk_source) { 1733 - ret = clk_prepare(i2c_dev->fast_clk); 1734 - if (ret < 0) { 1735 - dev_err(i2c_dev->dev, "Clock prepare failed %d\n", ret); 1736 - return ret; 1737 - } 1719 + ret = clk_prepare(i2c_dev->fast_clk); 1720 + if (ret < 0) { 1721 + dev_err(i2c_dev->dev, "Clock prepare failed %d\n", ret); 1722 + return ret; 1738 1723 } 1739 1724 1740 - if (i2c_dev->slow_clk) { 1741 - ret = clk_prepare(i2c_dev->slow_clk); 1742 - if (ret < 0) { 1743 - dev_err(dev, "failed to prepare slow clock: %d\n", ret); 1744 - goto unprepare_fast_clk; 1745 - } 1725 + ret = clk_prepare(i2c_dev->slow_clk); 1726 + if (ret < 0) { 1727 + dev_err(dev, "failed to prepare slow clock: %d\n", ret); 1728 + goto unprepare_fast_clk; 1746 1729 } 1747 1730 1748 1731 if (i2c_dev->bus_clk_rate > I2C_MAX_FAST_MODE_FREQ && ··· 1759 1750 goto unprepare_slow_clk; 1760 1751 } 1761 1752 1762 - pm_runtime_irq_safe(&pdev->dev); 1753 + /* 1754 + * VI I2C is in VE power domain which is not always on and not 1755 + * an IRQ safe. So, IRQ safe device can't be attached to a non-IRQ 1756 + * safe domain as it prevents powering off the PM domain. 1757 + * Also, VI I2C device don't need to use runtime IRQ safe as it will 1758 + * not be used for atomic transfers. 1759 + */ 1760 + if (!i2c_dev->is_vi) 1761 + pm_runtime_irq_safe(&pdev->dev); 1763 1762 pm_runtime_enable(&pdev->dev); 1764 1763 if (!pm_runtime_enabled(&pdev->dev)) { 1765 1764 ret = tegra_i2c_runtime_resume(&pdev->dev); ··· 1852 1835 clk_unprepare(i2c_dev->div_clk); 1853 1836 1854 1837 unprepare_slow_clk: 1855 - if (i2c_dev->is_vi) 1856 - clk_unprepare(i2c_dev->slow_clk); 1838 + clk_unprepare(i2c_dev->slow_clk); 1857 1839 1858 1840 unprepare_fast_clk: 1859 - if (!i2c_dev->hw->has_single_clk_source) 1860 - clk_unprepare(i2c_dev->fast_clk); 1841 + clk_unprepare(i2c_dev->fast_clk); 1861 1842 1862 1843 return ret; 1863 1844 } ··· 1874 1859 tegra_i2c_runtime_suspend(&pdev->dev); 1875 1860 1876 1861 clk_unprepare(i2c_dev->div_clk); 1877 - 1878 - if (i2c_dev->slow_clk) 1879 - clk_unprepare(i2c_dev->slow_clk); 1880 - 1881 - if (!i2c_dev->hw->has_single_clk_source) 1882 - clk_unprepare(i2c_dev->fast_clk); 1862 + clk_unprepare(i2c_dev->slow_clk); 1863 + clk_unprepare(i2c_dev->fast_clk); 1883 1864 1884 1865 tegra_i2c_release_dma(i2c_dev); 1885 1866 return 0;
+4 -4
drivers/i2c/busses/i2c-viapro.c
··· 228 228 goto exit_unsupported; 229 229 if (read_write == I2C_SMBUS_READ) 230 230 outb_p(data->block[0], SMBHSTDAT0); 231 - /* Fall through */ 231 + fallthrough; 232 232 case I2C_SMBUS_BLOCK_DATA: 233 233 outb_p(command, SMBHSTCMD); 234 234 if (read_write == I2C_SMBUS_WRITE) { ··· 489 489 } 490 490 } 491 491 492 - MODULE_AUTHOR("Kyosti Malkki <kmalkki@cc.hut.fi>, " 493 - "Mark D. Studebaker <mdsxyz123@yahoo.com> and " 494 - "Jean Delvare <jdelvare@suse.de>"); 492 + MODULE_AUTHOR("Kyosti Malkki <kmalkki@cc.hut.fi>"); 493 + MODULE_AUTHOR("Mark D. Studebaker <mdsxyz123@yahoo.com>"); 494 + MODULE_AUTHOR("Jean Delvare <jdelvare@suse.de>"); 495 495 MODULE_DESCRIPTION("vt82c596 SMBus driver"); 496 496 MODULE_LICENSE("GPL"); 497 497
+1 -1
drivers/i2c/busses/scx200_acb.c
··· 151 151 152 152 case state_repeat_start: 153 153 outb(inb(ACBCTL1) | ACBCTL1_START, ACBCTL1); 154 - /* fallthrough */ 154 + fallthrough; 155 155 156 156 case state_quick: 157 157 if (iface->address_byte & 1) {
+143 -15
drivers/i2c/i2c-core-base.c
··· 32 32 #include <linux/of_device.h> 33 33 #include <linux/of.h> 34 34 #include <linux/of_irq.h> 35 + #include <linux/pinctrl/consumer.h> 35 36 #include <linux/pm_domain.h> 36 37 #include <linux/pm_runtime.h> 37 38 #include <linux/pm_wakeirq.h> ··· 182 181 183 182 if (bri->prepare_recovery) 184 183 bri->prepare_recovery(adap); 184 + if (bri->pinctrl) 185 + pinctrl_select_state(bri->pinctrl, bri->pins_gpio); 185 186 186 187 /* 187 188 * If we can set SDA, we will always create a STOP to ensure additional ··· 239 236 240 237 if (bri->unprepare_recovery) 241 238 bri->unprepare_recovery(adap); 239 + if (bri->pinctrl) 240 + pinctrl_select_state(bri->pinctrl, bri->pins_default); 242 241 243 242 return ret; 244 243 } ··· 256 251 } 257 252 EXPORT_SYMBOL_GPL(i2c_recover_bus); 258 253 259 - static void i2c_init_recovery(struct i2c_adapter *adap) 254 + static void i2c_gpio_init_pinctrl_recovery(struct i2c_adapter *adap) 255 + { 256 + struct i2c_bus_recovery_info *bri = adap->bus_recovery_info; 257 + struct device *dev = &adap->dev; 258 + struct pinctrl *p = bri->pinctrl; 259 + 260 + /* 261 + * we can't change states without pinctrl, so remove the states if 262 + * populated 263 + */ 264 + if (!p) { 265 + bri->pins_default = NULL; 266 + bri->pins_gpio = NULL; 267 + return; 268 + } 269 + 270 + if (!bri->pins_default) { 271 + bri->pins_default = pinctrl_lookup_state(p, 272 + PINCTRL_STATE_DEFAULT); 273 + if (IS_ERR(bri->pins_default)) { 274 + dev_dbg(dev, PINCTRL_STATE_DEFAULT " state not found for GPIO recovery\n"); 275 + bri->pins_default = NULL; 276 + } 277 + } 278 + if (!bri->pins_gpio) { 279 + bri->pins_gpio = pinctrl_lookup_state(p, "gpio"); 280 + if (IS_ERR(bri->pins_gpio)) 281 + bri->pins_gpio = pinctrl_lookup_state(p, "recovery"); 282 + 283 + if (IS_ERR(bri->pins_gpio)) { 284 + dev_dbg(dev, "no gpio or recovery state found for GPIO recovery\n"); 285 + bri->pins_gpio = NULL; 286 + } 287 + } 288 + 289 + /* for pinctrl state changes, we need all the information */ 290 + if (bri->pins_default && bri->pins_gpio) { 291 + dev_info(dev, "using pinctrl states for GPIO recovery"); 292 + } else { 293 + bri->pinctrl = NULL; 294 + bri->pins_default = NULL; 295 + bri->pins_gpio = NULL; 296 + } 297 + } 298 + 299 + static int i2c_gpio_init_generic_recovery(struct i2c_adapter *adap) 300 + { 301 + struct i2c_bus_recovery_info *bri = adap->bus_recovery_info; 302 + struct device *dev = &adap->dev; 303 + struct gpio_desc *gpiod; 304 + int ret = 0; 305 + 306 + /* 307 + * don't touch the recovery information if the driver is not using 308 + * generic SCL recovery 309 + */ 310 + if (bri->recover_bus && bri->recover_bus != i2c_generic_scl_recovery) 311 + return 0; 312 + 313 + /* 314 + * pins might be taken as GPIO, so we should inform pinctrl about 315 + * this and move the state to GPIO 316 + */ 317 + if (bri->pinctrl) 318 + pinctrl_select_state(bri->pinctrl, bri->pins_gpio); 319 + 320 + /* 321 + * if there is incomplete or no recovery information, see if generic 322 + * GPIO recovery is available 323 + */ 324 + if (!bri->scl_gpiod) { 325 + gpiod = devm_gpiod_get(dev, "scl", GPIOD_OUT_HIGH_OPEN_DRAIN); 326 + if (PTR_ERR(gpiod) == -EPROBE_DEFER) { 327 + ret = -EPROBE_DEFER; 328 + goto cleanup_pinctrl_state; 329 + } 330 + if (!IS_ERR(gpiod)) { 331 + bri->scl_gpiod = gpiod; 332 + bri->recover_bus = i2c_generic_scl_recovery; 333 + dev_info(dev, "using generic GPIOs for recovery\n"); 334 + } 335 + } 336 + 337 + /* SDA GPIOD line is optional, so we care about DEFER only */ 338 + if (!bri->sda_gpiod) { 339 + /* 340 + * We have SCL. Pull SCL low and wait a bit so that SDA glitches 341 + * have no effect. 342 + */ 343 + gpiod_direction_output(bri->scl_gpiod, 0); 344 + udelay(10); 345 + gpiod = devm_gpiod_get(dev, "sda", GPIOD_IN); 346 + 347 + /* Wait a bit in case of a SDA glitch, and then release SCL. */ 348 + udelay(10); 349 + gpiod_direction_output(bri->scl_gpiod, 1); 350 + 351 + if (PTR_ERR(gpiod) == -EPROBE_DEFER) { 352 + ret = -EPROBE_DEFER; 353 + goto cleanup_pinctrl_state; 354 + } 355 + if (!IS_ERR(gpiod)) 356 + bri->sda_gpiod = gpiod; 357 + } 358 + 359 + cleanup_pinctrl_state: 360 + /* change the state of the pins back to their default state */ 361 + if (bri->pinctrl) 362 + pinctrl_select_state(bri->pinctrl, bri->pins_default); 363 + 364 + return ret; 365 + } 366 + 367 + static int i2c_gpio_init_recovery(struct i2c_adapter *adap) 368 + { 369 + i2c_gpio_init_pinctrl_recovery(adap); 370 + return i2c_gpio_init_generic_recovery(adap); 371 + } 372 + 373 + static int i2c_init_recovery(struct i2c_adapter *adap) 260 374 { 261 375 struct i2c_bus_recovery_info *bri = adap->bus_recovery_info; 262 376 char *err_str; 263 377 264 378 if (!bri) 265 - return; 379 + return 0; 380 + 381 + if (i2c_gpio_init_recovery(adap) == -EPROBE_DEFER) 382 + return -EPROBE_DEFER; 266 383 267 384 if (!bri->recover_bus) { 268 385 err_str = "no recover_bus() found"; ··· 400 273 if (gpiod_get_direction(bri->sda_gpiod) == 0) 401 274 bri->set_sda = set_sda_gpio_value; 402 275 } 403 - return; 404 - } 405 - 406 - if (bri->recover_bus == i2c_generic_scl_recovery) { 276 + } else if (bri->recover_bus == i2c_generic_scl_recovery) { 407 277 /* Generic SCL recovery */ 408 278 if (!bri->set_scl || !bri->get_scl) { 409 279 err_str = "no {get|set}_scl() found"; ··· 412 288 } 413 289 } 414 290 415 - return; 291 + return 0; 416 292 err: 417 293 dev_err(&adap->dev, "Not using recovery: %s\n", err_str); 418 294 adap->bus_recovery_info = NULL; 295 + 296 + return -EINVAL; 419 297 } 420 298 421 299 static int i2c_smbus_host_notify_to_irq(const struct i2c_client *client) ··· 445 319 if (!client) 446 320 return 0; 447 321 448 - driver = to_i2c_driver(dev->driver); 449 - 450 322 client->irq = client->init_irq; 451 323 452 - if (!client->irq && !driver->disable_i2c_core_irq_mapping) { 324 + if (!client->irq) { 453 325 int irq = -ENOENT; 454 326 455 327 if (client->flags & I2C_CLIENT_HOST_NOTIFY) { ··· 472 348 473 349 client->irq = irq; 474 350 } 351 + 352 + driver = to_i2c_driver(dev->driver); 475 353 476 354 /* 477 355 * An I2C ID table is not mandatory, if and only if, a suitable OF ··· 1353 1227 if (!i2c_check_functionality(adap, I2C_FUNC_SMBUS_HOST_NOTIFY)) 1354 1228 return 0; 1355 1229 1356 - domain = irq_domain_create_linear(adap->dev.fwnode, 1230 + domain = irq_domain_create_linear(adap->dev.parent->fwnode, 1357 1231 I2C_ADDR_7BITS_COUNT, 1358 1232 &i2c_host_notify_irq_ops, adap); 1359 1233 if (!domain) ··· 1444 1318 if (res) 1445 1319 goto out_reg; 1446 1320 1447 - dev_dbg(&adap->dev, "adapter [%s] registered\n", adap->name); 1448 - 1449 1321 pm_runtime_no_callbacks(&adap->dev); 1450 1322 pm_suspend_ignore_children(&adap->dev, true); 1451 1323 pm_runtime_enable(&adap->dev); 1324 + 1325 + res = i2c_init_recovery(adap); 1326 + if (res == -EPROBE_DEFER) 1327 + goto out_reg; 1328 + 1329 + dev_dbg(&adap->dev, "adapter [%s] registered\n", adap->name); 1452 1330 1453 1331 #ifdef CONFIG_I2C_COMPAT 1454 1332 res = class_compat_create_link(i2c_adapter_compat_class, &adap->dev, ··· 1461 1331 dev_warn(&adap->dev, 1462 1332 "Failed to create compatibility class link\n"); 1463 1333 #endif 1464 - 1465 - i2c_init_recovery(adap); 1466 1334 1467 1335 /* create pre-declared device nodes */ 1468 1336 of_i2c_register_devices(adap);
+2 -2
drivers/i2c/i2c-dev.c
··· 761 761 unregister_chrdev_region(MKDEV(I2C_MAJOR, 0), I2C_MINORS); 762 762 } 763 763 764 - MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl> and " 765 - "Simon G. Vogl <simon@tk.uni-linz.ac.at>"); 764 + MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl>"); 765 + MODULE_AUTHOR("Simon G. Vogl <simon@tk.uni-linz.ac.at>"); 766 766 MODULE_DESCRIPTION("I2C /dev entries driver"); 767 767 MODULE_LICENSE("GPL"); 768 768
+1 -1
drivers/i2c/i2c-slave-eeprom.c
··· 66 66 case I2C_SLAVE_READ_PROCESSED: 67 67 /* The previous byte made it to the bus, get next one */ 68 68 eeprom->buffer_idx++; 69 - /* fallthrough */ 69 + fallthrough; 70 70 case I2C_SLAVE_READ_REQUESTED: 71 71 spin_lock(&eeprom->buffer_lock); 72 72 *val = eeprom->buffer[eeprom->buffer_idx & eeprom->address_mask];
+11 -3
include/linux/i2c.h
··· 231 231 * @detect: Callback for device detection 232 232 * @address_list: The I2C addresses to probe (for detect) 233 233 * @clients: List of detected clients we created (for i2c-core use only) 234 - * @disable_i2c_core_irq_mapping: Tell the i2c-core to not do irq-mapping 235 234 * 236 235 * The driver.owner field should be set to the module owner of this driver. 237 236 * The driver.name field should be set to the name of this driver. ··· 289 290 int (*detect)(struct i2c_client *client, struct i2c_board_info *info); 290 291 const unsigned short *address_list; 291 292 struct list_head clients; 292 - 293 - bool disable_i2c_core_irq_mapping; 294 293 }; 295 294 #define to_i2c_driver(d) container_of(d, struct i2c_driver, driver) 296 295 ··· 606 609 * may configure padmux here for SDA/SCL line or something else they want. 607 610 * @scl_gpiod: gpiod of the SCL line. Only required for GPIO recovery. 608 611 * @sda_gpiod: gpiod of the SDA line. Only required for GPIO recovery. 612 + * @pinctrl: pinctrl used by GPIO recovery to change the state of the I2C pins. 613 + * Optional. 614 + * @pins_default: default pinctrl state of SCL/SDA lines, when they are assigned 615 + * to the I2C bus. Optional. Populated internally for GPIO recovery, if 616 + * state with the name PINCTRL_STATE_DEFAULT is found and pinctrl is valid. 617 + * @pins_gpio: recovery pinctrl state of SCL/SDA lines, when they are used as 618 + * GPIOs. Optional. Populated internally for GPIO recovery, if this state 619 + * is called "gpio" or "recovery" and pinctrl is valid. 609 620 */ 610 621 struct i2c_bus_recovery_info { 611 622 int (*recover_bus)(struct i2c_adapter *adap); ··· 630 625 /* gpio recovery */ 631 626 struct gpio_desc *scl_gpiod; 632 627 struct gpio_desc *sda_gpiod; 628 + struct pinctrl *pinctrl; 629 + struct pinctrl_state *pins_default; 630 + struct pinctrl_state *pins_gpio; 633 631 }; 634 632 635 633 int i2c_recover_bus(struct i2c_adapter *adap);