aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2020-05-30dt-bindings: i2c: dw: Add Baikal-T1 SoC I2C controllerSerge Semin1-0/+2
Add the "baikal,bt1-sys-i2c" compatible string to the DW I2C binding. Even though the corresponding node is supposed to be a child of the Baikal-T1 System Controller, its reg property is left required for compatibility. Signed-off-by: Serge Semin <[email protected]> Reviewed-by: Rob Herring <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2020-05-30dt-bindings: i2c: Convert DW I2C slave to the DW I2C master exampleSerge Semin1-2/+2
dtc currently doesn't support I2C_OWN_SLAVE_ADDRESS flag set in the i2c "reg" property. If dtc finds an i2c-slave sub-node having an address higher than ten-bits wide it'll print an ugly warning: Warning (i2c_bus_reg): /example-2/i2c@1120000/eeprom@64: I2C bus unit address format error, expected "40000064" Warning (i2c_bus_reg): /example-2/i2c@1120000/eeprom@64:reg: I2C address must be less than 10-bits, got "0x40000064" In order to silence dtc up let's replace the corresponding DT binding example with a normal DW I2C master mode-based one. It's done by clearing the I2C_OWN_SLAVE_ADDRESS bit in the reg property and converting the sub-node to be compatible with normal EEPROM like "atmel,24c02". Just revert this commit when dtc is fixed. Signed-off-by: Serge Semin <[email protected]> Reviewed-by: Rob Herring <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2020-05-30dt-bindings: i2c: Convert DW I2C binding to DT schemaSerge Semin2-73/+154
Modern device tree bindings are supposed to be created as YAML-files in accordance with dt-schema. This commit replaces Synopsys DW I2C legacy bare text bindings with YAML file. As before the bindings file states that the corresponding dts node is supposed to be compatible either with generic DW I2C controller or with Microsemi Ocelot SoC I2C one, to have registers, interrupts and clocks properties. In addition the node may have clock-frequency, i2c-sda-hold-time-ns, i2c-scl-falling-time-ns and i2c-sda-falling-time-ns optional properties. Signed-off-by: Serge Semin <[email protected]> Reviewed-by: Rob Herring <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2020-05-29i2c: sh_mobile: simplify code and remove false compilation warningViresh Kumar1-5/+2
This currently generates a warning: drivers/i2c/busses/i2c-sh_mobile.c: In function 'sh_mobile_i2c_isr': drivers/i2c/busses/i2c-sh_mobile.c:399:26: warning: 'data' may be used uninitialized in this function [-Wmaybe-uninitialized] Though the code looks okay and shouldn't ever use the variable uninitialized. Fix the warning by moving the code around and getting rid of 'data'. Signed-off-by: Viresh Kumar <[email protected]> Tested-by: Wolfram Sang <[email protected]> [wsa: minor updates to commit message] Signed-off-by: Wolfram Sang <[email protected]>
2020-05-29i2c: i801: Instantiate SPD EEPROMs automaticallyJean Delvare1-0/+6
Call the function to instantiate SPD EEPROMs automatically on the main SMBus controller. Multiplexed SMBus systems are excluded for now as they are more complex to handle. Signed-off-by: Jean Delvare <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2020-05-29i2c: smbus: Add a way to instantiate SPD EEPROMs automaticallyJean Delvare2-2/+110
In simple cases we can instantiate SPD EEPROMs on the SMBus automatically. Start with just DDR2, DDR3 and DDR4 on x86 for now, and only for systems with no more than 4 memory slots. These limitations may be lifted later. Signed-off-by: Jean Delvare <[email protected]> [wsa: minor change for new API] Signed-off-by: Wolfram Sang <[email protected]>
2020-05-28i2c: avoid confusing naming in headerWolfram Sang1-4/+4
i2c_client pointers are usually named 'client'. Use it here to get rid of the ambiguity of 'dev->dev'. Signed-off-by: Wolfram Sang <[email protected]>
2020-05-28i2c: slave-eeprom: update documentation to recent changesWolfram Sang1-4/+3
Support for 16-bit addresses has been added, so remove it from the todo list. Also, in the introductory sentence, may clear we talk about "slave IP cores" to make reading easier. Fixes: 82d514815441 ("i2c-eeprom_slave: Add support for more eeprom models") Signed-off-by: Wolfram Sang <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2020-05-28i2c: slave-eeprom: skip useless initializationWolfram Sang1-1/+0
We have a kzalloced struct, no need to init to 0. Signed-off-by: Wolfram Sang <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2020-05-28i2c: acpi: Drop double check for ACPI companion deviceAndy Shevchenko1-5/+1
acpi_dev_get_resources() does perform the NULL pointer check against ACPI companion device which is given as function parameter. Thus, there is no need to duplicate this check in the caller. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2020-05-27i2c: nvidia-gpu: Use PTR_ERR_OR_ZERO() to simplify codeAishwarya Ramakrishnan1-4/+1
PTR_ERR_OR_ZERO contains if(IS_ERR(...)) + PTR_ERR. Generated by: scripts/coccinelle/api/ptr_ret.cocci Signed-off-by: Aishwarya Ramakrishnan <[email protected]> Reviewed-by: Ajay Gupta <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2020-05-27i2c: save a variable in i2c_detect()Wolfram Sang1-2/+1
No need to populate a variable if it is used only in debug output which may get compiled away anyhow. Signed-off-by: Wolfram Sang <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2020-05-22i2c: efm32: Avoid unnecessary check in efm32_i2c_probe()Tang Bin1-3/+0
The function efm32_i2c_probe() is only called with an openfirmware platform device.Therefore there is no need to check that it has an openfirmware node. Signed-off-by: Shengju Zhang <[email protected]> Signed-off-by: Tang Bin <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2020-05-22i2c: efm32: Omit superfluous error message in efm32_i2c_probe()Tang Bin1-1/+0
In the function efm32_i2c_probe(),when get irq failed,the function platform_get_irq() logs an error message,so remove redundant message here. Signed-off-by: Shengju Zhang <[email protected]> Signed-off-by: Tang Bin <[email protected]> Acked-by: Uwe Kleine-König <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2020-05-22Revert "dt-binding: i2c: add bus-supply property"Wolfram Sang1-3/+0
This reverts commit 6aab46bc52a8f579879d491c9d8062e03caa5c61. Testing in linux-next showed it needs some more time. Signed-off-by: Wolfram Sang <[email protected]>
2020-05-22Revert "i2c: core: support bus regulator controlling in adapter"Wolfram Sang2-86/+0
This reverts commit 6fe12cdbcfe35ad4726a619a9546822d34fc934c. Testing in linux-next showed it needs some more time. Signed-off-by: Wolfram Sang <[email protected]>
2020-05-22i2c: designware: Drop hard coded FIFO depth assignmentAndy Shevchenko2-20/+0
It's not clear why the commit fe20ff5c7e9c ("i2c-designware: Add support for Designware core behind PCI devices.") followed by commit b61b14154b19 ("i2c-designware: add support for Intel Lynxpoint") chose to hard code FIFO depth size. The FIFO depth on all hardware, I have tested on, can be nicely detected automatically. Thus, we may safely drop hard coded FIFO sizes from the driver. Signed-off-by: Andy Shevchenko <[email protected]> Acked-by: Jarkko Nikula <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2020-05-22i2c: designware: Read counters from ACPI for PCI driverAndy Shevchenko1-0/+11
PCI devices may have been backed with ACPI handle which supplies an additional information to the drivers, such as counters. Call for ACPI configuration from PCI driver in order to utilize counters provided by ACPI. Signed-off-by: Andy Shevchenko <[email protected]> Acked-by: Jarkko Nikula <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2020-05-22i2c: designware: Move ACPI parts into common moduleAndy Shevchenko3-119/+142
For possible code reuse in the future, move ACPI parts into common module. Signed-off-by: Andy Shevchenko <[email protected]> Acked-by: Jarkko Nikula <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2020-05-22i2c: designware: Drop unneeded condition in i2c_dw_validate_speed()Andy Shevchenko1-8/+6
We may bailout directly from the loop instead of breaking it and testing a loop counter. This also gives advantages such as decreased indentation level along with dropped unneeded condition. Signed-off-by: Andy Shevchenko <[email protected]> Acked-by: Jarkko Nikula <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2020-05-22i2c: designware: Move i2c_dw_validate_speed() helper to a common codeAndy Shevchenko3-24/+38
In order to export array supported speed for wider use, move it to a header along with i2c_dw_validate_speed() helper moved to a common code. No functional changes intended. Signed-off-by: Andy Shevchenko <[email protected]> Acked-by: Jarkko Nikula <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2020-05-22i2c: designware: Include proper headers in i2c-desingware-core.hAndy Shevchenko1-0/+9
This header is a user of some generic ones, include them respectively. Signed-off-by: Andy Shevchenko <[email protected]> Acked-by: Jarkko Nikula <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2020-05-22i2c: designware: Get rid of PCI driver specifics in common codeAndy Shevchenko2-11/+14
Do not spread PCI specifics over common code. It seems to be a layering violation which can be easily avoided. Refactor PCI driver and drop PCI specifics from common code. Signed-off-by: Andy Shevchenko <[email protected]> Acked-by: Jarkko Nikula <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2020-05-20i2c: pxa: implement generic i2c bus recoveryRussell King1-17/+159
Implement generic GPIO-based I2C bus recovery for the PXA I2C driver. Reviewed-by: Andrew Lunn <[email protected]> Signed-off-by: Russell King <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2020-05-20Merge tag 'for-5.8-i2c' of ↵Wolfram Sang1-69/+179
git://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux into i2c/for-5.8 i2c: tegra: Changes for v5.8-rc1 This includes a few improvements to make the Tegra I2C controller behave properly on suspend/resume, does a bit of cleanup and adds support for the VI-variant of the I2C controller that is used primarily for video capture purposes.
2020-05-20i2c: altera: cleanup spinlockAtsushi Nemoto1-8/+4
Protect altr_i2c_int_enable() by the mutex and remove unneeded spinlock. Signed-off-by: Atsushi Nemoto <[email protected]> Reviewed-by: Thor Thayer <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2020-05-20Merge branch 'i2c/for-current-fixed' into i2c/for-5.8Wolfram Sang915-5274/+9363
2020-05-20i2c: core: support bus regulator controlling in adapterBibby Hsieh2-0/+86
Although in the most platforms, the bus power of i2c are alway on, some platforms disable the i2c bus power in order to meet low power request. We get and enable bulk regulator in i2c adapter device. Signed-off-by: Bibby Hsieh <[email protected]> Reviewed-by: Tomasz Figa <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2020-05-20dt-binding: i2c: add bus-supply propertyBibby Hsieh1-0/+3
In some platforms, they disable the power-supply of i2c due to power consumption reduction. This patch add bus-supply property. Signed-off-by: Bibby Hsieh <[email protected]> Acked-by: Rob Herring <[email protected]> [wsa: rebased to i2c/for-next] Signed-off-by: Wolfram Sang <[email protected]>
2020-05-20i2c: reword explanation about atomic transfersWolfram Sang1-3/+3
Atomic transfers are not only about sending messages like the original wording suggested. Speak of 'accessing' now like in i2c.h. Reported-by: Michał Mirosław <[email protected]> Signed-off-by: Wolfram Sang <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2020-05-20i2c: slave-eeprom: add support for 24c512 EEPROMsWolfram Sang1-2/+4
I don't plan to support every EEPROM type, but the 24c512 ones need a tiny code update, so let's have that upstream. Reported-by: Patrick Williams <[email protected]> Signed-off-by: Wolfram Sang <[email protected]> Reviewed-by: Patrick Williams <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2020-05-20i2c: mediatek: Add i2c ac-timing adjust supportQii Wang1-51/+278
This patch adds a algorithm to calculate some ac-timing parameters which can fully meet I2C Spec. Signed-off-by: Qii Wang <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2020-05-15MAINTAINERS: add maintainer for mediatek i2c controller driverQii Wang1-0/+7
Add Qii Wang as maintainer for mediatek i2c controller driver. Signed-off-by: Qii Wang <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2020-05-15i2c: mux: Replace zero-length array with flexible-arrayGustavo A. R. Silva1-1/+1
The current codebase makes use of the zero-length array language extension to the C90 standard, but the preferred mechanism to declare variable-length types such as these ones is a flexible array member[1][2], introduced in C99: struct foo { int stuff; struct boo array[]; }; By making use of the mechanism above, we will get a compiler warning in case the flexible array does not occur last in the structure, which will help us prevent some kind of undefined behavior bugs from being inadvertently introduced[3] to the codebase from now on. Also, notice that, dynamic memory allocations won't be affected by this change: "Flexible array members have incomplete type, and so the sizeof operator may not be applied. As a quirk of the original implementation of zero-length arrays, sizeof evaluates to zero."[1] sizeof(flexible-array-member) triggers a warning because flexible array members have incomplete type[1]. There are some instances of code in which the sizeof operator is being incorrectly/erroneously applied to zero-length arrays and the result is zero. Such instances may be hiding some bugs. So, this work (flexible-array member conversions) will also help to get completely rid of those sorts of issues. This issue was found with the help of Coccinelle. [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html [2] https://github.com/KSPP/linux/issues/21 [3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour") Signed-off-by: Gustavo A. R. Silva <[email protected]> Reviewed-by: Peter Rosin <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2020-05-15i2c: mux: demux-pinctrl: Fix an error handling path in ↵Christophe JAILLET1-0/+1
'i2c_demux_pinctrl_probe()' A call to 'i2c_demux_deactivate_master()' is missing in the error handling path, as already done in the remove function. Fixes: 50a5ba876908 ("i2c: mux: demux-pinctrl: add driver") Signed-off-by: Christophe JAILLET <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2020-05-15i2c: altera: Fix race between xfer_msg and isr threadAtsushi Nemoto1-1/+9
Use a mutex to protect access to idev->msg_len, idev->buf, etc. which are modified by both altr_i2c_xfer_msg() and altr_i2c_isr(). This is the minimal fix for easy backporting. A cleanup to remove the spinlock will be added later. Signed-off-by: Atsushi Nemoto <[email protected]> Acked-by: Thor Thayer <[email protected]> [wsa: updated commit message] Signed-off-by: Wolfram Sang <[email protected]>
2020-05-15i2c: algo-pca: update contact emailWolfram Sang1-1/+1
The 'pengutronix' address is defunct for years. Use the proper contact address. Signed-off-by: Wolfram Sang <[email protected]>
2020-05-15i2c: at91: Fix pinmux after devm_gpiod_get() for bus recoveryCodrin Ciubotariu1-3/+17
devm_gpiod_get() usually calls gpio_request_enable() for non-strict pinmux drivers. These puts the pins in GPIO mode, whithout notifying the pinctrl driver. At this point, the I2C bus no longer owns the pins. To mux the pins back to the I2C bus, we use the pinctrl driver to change the state of the pins to GPIO, before using devm_gpiod_get(). After the pins are received as GPIOs, we switch theer pinctrl state back to the default one, Fixes: d3d3fdcc4c90 ("i2c: at91: implement i2c bus recovery") Signed-off-by: Codrin Ciubotariu <[email protected]> Acked-by: Ludovic Desroches <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2020-05-13i2c: designware: Allow slave mode for PCI enumerated devicesAndy Shevchenko2-13/+12
Allow slave mode for PCI enumerated devices by calling a common i2c_dw_probe() instead of i2c_dw_probe_master(). While dropping dependency to platform driver in slave module, move its configuration section above, closer to core. Signed-off-by: Andy Shevchenko <[email protected]> Acked-by: Jarkko Nikula <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2020-05-13i2c: designware: Rename i2c_dw_probe() to i2c_dw_probe_master()Andy Shevchenko5-10/+20
As a preparatory patch to support slave mode for PCI enumerated devices rename i2c_dw_probe() to i2c_dw_probe_master() and split common i2c_dw_probe() as inline helper. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2020-05-13i2c: designware: Switch PCI driver to use i2c_dw_configure_master()Andy Shevchenko1-26/+7
Since we have available helper to configure master mode, let's use it in the PCI driver instead of spread open-coded variant. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2020-05-13i2c: designware: Move configuration routines to respective modulesAndy Shevchenko4-37/+48
Move configuration routines to respective modules, i.e. master and slave. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2020-05-13i2c: designware: Use devm_platform_ioremap_resource() to simplify codeAndy Shevchenko1-6/+2
Use devm_platform_ioremap_resource() instead of platform_get_resource() + devm_ioremap_resource(). Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2020-05-12i2c: tegra: Add support for the VI I2C on Tegra210Thierry Reding1-2/+95
Tegra210 has an extra instance of the I2C controller that is in the domain of host1x and usually used for camera use-cases. The programming model for the VI variant of the controller is roughly the same as for the other variants, except that the I2C registers start at an offset and are spaced further apart. VI I2C also doesn't support slave mode. Signed-off-by: Thierry Reding <[email protected]>
2020-05-12i2c: tegra: Use FIELD_PREP/FIELD_GET macrosThierry Reding1-41/+40
Using these macros helps increase readability of the code. Signed-off-by: Thierry Reding <[email protected]>
2020-05-12i2c: pxa: use master-abort for device probesRussell King1-8/+2
Use master-abort to send the stop condition after an address cycle rather than resetting the controller. Signed-off-by: Russell King <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2020-05-12i2c: pxa: clear all master action bits in i2c_pxa_stop_message()Russell King1-4/+2
If we timeout during a message transfer, the control register may contain bits that cause an action to be set. Read-modify-writing the register leaving these bits set may trigger the hardware to attempt one of these actions unintentionally. Always clear these bits when cleaning up after a message or after a timeout. Signed-off-by: Russell King <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2020-05-12i2c: pxa: remove some unnecessary debugRussell King1-3/+1
Remove unnecessary show_state() in the loop inside i2c_pxa_pio_set_master(), which can be unnecessarily verbose. Remove the i2c_pxa_scream_blue_murder() in i2c_pxa_pio_xfer(), which will trigger if we are probing the I2C bus and a slave does not respond; this is a normal event, and not something to report. Signed-off-by: Russell King <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2020-05-12i2c: pxa: ensure timeout messages are uniqueRussell King1-3/+3
Ensure that the various timeout messages can identify where in the code they were produced from to aid debugging. Signed-off-by: Russell King <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2020-05-12i2c: pxa: avoid complaints with non-responsive slavesRussell King1-4/+8
Running i2cdetect on a PXA I2C adapter is very noisy; it complains whenever a slave fails to respond to the address cycle. Since it is normal to probe for slaves in this way, we should not fill the kernel log. This is especially true with SFP modules that take a while to respond on the I2C bus, and probing via the I2C bus is the only way to detect that they are ready. Fix this by changing the internal transfer return code from I2C_RETRY to a new NO_SLAVE code (mapped to -ENXIO, as per the I2C documentation for this condition, but we still return -EREMOTEIO to the I2C stack to maintain long established driver behaviour.) Signed-off-by: Russell King <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>