- 27 Sep, 2020 9 commits
-
-
Krzysztof Kozlowski authored
The i.MX 7 DTSes use two compatibles so update the binding to fix dtbs_check warnings like: arch/arm/boot/dts/imx7d-cl-som-imx7.dt.yaml: i2c@30a20000: compatible: ['fsl,imx7d-i2c', 'fsl,imx21-i2c'] is not valid under any of the given schemas (Possible causes of the failure): arch/arm/boot/dts/imx7d-cl-som-imx7.dt.yaml: i2c@30a20000: compatible: ['fsl,imx7d-i2c', 'fsl,imx21-i2c'] is too long Signed-off-by:
Krzysztof Kozlowski <krzk@kernel.org> Reviewed-by:
Rob Herring <robh@kernel.org> Signed-off-by:
Wolfram Sang <wsa@kernel.org>
-
Krzysztof Kozlowski authored
Additional properties actually might appear (e.g. power-domains) so describe all typical properties, reference generic i2c schema and use unevaluatedProperties to fix dtbs_check warnings like: arch/arm64/boot/dts/freescale/imx8mn-evk.dt.yaml: i2c@30a20000: '#address-cells', '#size-cells', 'pmic@25' do not match any of the regexes: 'pinctrl-[0-9]+' Signed-off-by:
Krzysztof Kozlowski <krzk@kernel.org> Reviewed-by:
Rob Herring <robh@kernel.org> Signed-off-by:
Wolfram Sang <wsa@kernel.org>
-
Krzysztof Kozlowski authored
The i.MX 8QXP DTSes use two compatibles so update the binding to fix dtbs_check warnings like: arch/arm64/boot/dts/freescale/imx8qxp-mek.dt.yaml: i2c@5a820000: compatible: ['fsl,imx8qxp-lpi2c', 'fsl,imx7ulp-lpi2c'] is too long Signed-off-by:
Krzysztof Kozlowski <krzk@kernel.org> Reviewed-by:
Rob Herring <robh@kernel.org> Signed-off-by:
Wolfram Sang <wsa@kernel.org>
-
Krzysztof Kozlowski authored
Additional properties actually might appear (e.g. power-domains) so describe all typical properties, reference generic i2c schema and use unevaluatedProperties to fix dtbs_check warnings like: arch/arm64/boot/dts/freescale/imx8qxp-ai_ml.dt.yaml: i2c@5a800000: 'assigned-clock-rates', 'assigned-clocks', 'clock-names', 'power-domains' do not match any of the regexes: 'pinctrl-[0-9]+' arch/arm64/boot/dts/freescale/imx8qxp-colibri-eval-v3.dt.yaml: i2c@5a800000: 'touchscreen@2c' does not match any of the regexes: 'pinctrl-[0-9]+' Signed-off-by:
Krzysztof Kozlowski <krzk@kernel.org> Reviewed-by:
Rob Herring <robh@kernel.org> Signed-off-by:
Wolfram Sang <wsa@kernel.org>
-
Krzysztof Kozlowski authored
If interrupt comes late, during probe error path or device remove (could be triggered with CONFIG_DEBUG_SHIRQ), the interrupt handler i2c_imx_isr() will access registers with the clock being disabled. This leads to external abort on non-linefetch on Toradex Colibri VF50 module (with Vybrid VF5xx): Unhandled fault: external abort on non-linefetch (0x1008) at 0x8882d003 Internal error: : 1008 [#1] ARM Modules linked in: CPU: 0 PID: 1 Comm: swapper Not tainted 5.7.0 #607 Hardware name: Freescale Vybrid VF5xx/VF6xx (Device Tree) (i2c_imx_isr) from [<8017009c>] (free_irq+0x25c/0x3b0) (free_irq) from [<805844ec>] (release_nodes+0x178/0x284) (release_nodes) from [<80580030>] (really_probe+0x10c/0x348) (really_probe) from [<80580380>] (driver_probe_device+0x60/0x170) (driver_probe_device) from [<80580630>] (device_driver_attach+0x58/0x60) (device_driver_attach) from [<805806bc>] (__driver_attach+0x84/0xc0) (__driver_attach) from [<8057e228>] (bus_for_each_dev+0x68/0xb4) (bus_for_each_dev) from [<8057f3ec>] (bus_add_driver+0x144/0x1ec) (bus_add_driver) from [<80581320>] (driver_register+0x78/0x110) (driver_register) from [<8010213c>] (do_one_initcall+0xa8/0x2f4) (do_one_initcall) from [<80c0100c>] (kernel_init_freeable+0x178/0x1dc) (kernel_init_freeable) from [<80807048>] (kernel_init+0x8/0x110) (kernel_init) from [<80100114>] (ret_from_fork+0x14/0x20) Additionally, the i2c_imx_isr() could wake up the wait queue (imx_i2c_struct->queue) before its initialization happens. The resource-managed framework should not be used for interrupt handling, because the resource will be released too late - after disabling clocks. The interrupt handler is not prepared for such case. Fixes: 1c4b6c3b ("i2c: imx: implement bus recovery") Cc: <stable@vger.kernel.org> Signed-off-by:
Krzysztof Kozlowski <krzk@kernel.org> Acked-by:
Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by:
Wolfram Sang <wsa@kernel.org>
-
Krzysztof Kozlowski authored
Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and the error value gets printed. Signed-off-by:
Krzysztof Kozlowski <krzk@kernel.org> Reviewed-by:
Heiko Stuebner <heiko@sntech.de> Signed-off-by:
Wolfram Sang <wsa@kernel.org>
-
Khalil Blaiech authored
Add BlueField I2C driver to offer master and slave support for Mellanox BlueField SoCs. The driver implements an SMBus adapter and interfaces to multiple busses that can be probed using both ACPI and Device Tree infrastructures. The driver supports several SMBus operations to transfer data back and forth from/to various I2C devices. It is mainly intended to be consumed by userspace tools and utilities, such as i2c-tools and decode-dimms to collect memory module information. On the other hand, the driver has a slave function to support, among others, an IPMB interface that requires both master and slave functions to handle transfers between the BlueField SoC and a board management controllers (e.g., BMC). Signed-off-by:
Khalil Blaiech <kblaiech@mellanox.com> Reviewed-by:
Vadim Pasternak <vadimp@mellanox.com> Signed-off-by:
Wolfram Sang <wsa@kernel.org>
-
Khalil Blaiech authored
Add device tree bindings documentation for Mellanox BlueField I2C SMBus controller. Signed-off-by:
Khalil Blaiech <kblaiech@mellanox.com> Signed-off-by:
Wolfram Sang <wsa@kernel.org>
-
Wolfram Sang authored
Merge tag 'at24-updates-for-v5.10' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux into i2c/for-5.10 at24 updates for v5.10 - add support for masking sensitive data in VAIO EEPROMs - set the nvmem TYPE to NVMEM_TYPE_EEPROM - add support for the new 'label' property - set the nvmem ID to NVMEM_DEVID_AUTO by default (for backward compatibility) or to NVMEM_DEVID_NONE if label is defined
-
- 25 Sep, 2020 1 commit
-
-
Jon Hunter authored
By using the label property, a more descriptive name can be populated for AT24 EEPROMs NVMEM device. Update the AT24 driver to check to see if the label property is present and if so, use this as the name for NVMEM device. Please note that when the 'label' property is present for the AT24 EEPROM, we do not want the NVMEM driver to append the 'devid' to the name and so the nvmem_config.id is initialised to NVMEM_DEVID_NONE. Signed-off-by:
Jon Hunter <jonathanh@nvidia.com> Signed-off-by:
Bartosz Golaszewski <bgolaszewski@baylibre.com>
-
- 24 Sep, 2020 2 commits
-
-
Jon Hunter authored
Add a label property for the AT24 EEPROM to allow a custom name to be used for identifying the EEPROM on a board. This is useful when there is more than one EEPROM present. Signed-off-by:
Jon Hunter <jonathanh@nvidia.com> Reviewed-by:
Rob Herring <robh@kernel.org> Signed-off-by:
Bartosz Golaszewski <bgolaszewski@baylibre.com>
-
Jon Hunter authored
The AT24 EEPROM driver does not initialise the 'id' field of the nvmem_config structure and because the entire structure is not initialised, it ends up with a random value. This causes the NVMEM driver to append the device 'devid' value to name of the NVMEM device. Ideally for I2C devices such as the AT24 that already have a unique name, we would not bother to append the 'devid'. However, given that this has always been done for AT24 devices, we cannot remove the 'devid' as this will change the name of the userspace sysfs node for the NVMEM device. Nonetheless we should ensure that the 'id' field of the nvmem_config structure is initialised so that there is no chance of a random value causes problems in the future. Therefore, set the NVMEM config.id to NVMEM_DEVID_AUTO for AT24 EEPROMs so that the 'devid' is always appended. Signed-off-by:
Jon Hunter <jonathanh@nvidia.com> Signed-off-by:
Bartosz Golaszewski <bgolaszewski@baylibre.com>
-
- 21 Sep, 2020 13 commits
-
-
Andy Shevchenko authored
This makes the driver code slightly easier to read. Signed-off-by:
Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by:
Ajay Gupta <ajayg@nvidia.com> Signed-off-by:
Wolfram Sang <wsa@kernel.org>
-
Andy Shevchenko authored
Add PCI ID for the Intel Emmitsburg PCH iSMT SMBus controller. Signed-off-by:
Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by:
Seth Heasley <seth.heasley@linux.intel.com> Signed-off-by:
Wolfram Sang <wsa@kernel.org>
-
Andy Shevchenko authored
Kernel doc validation script complains: CHECK .../drivers/i2c/busses/i2c-ismt.c .../i2c-ismt.c:182: warning: cannot understand function prototype: 'const struct pci_device_id ismt_ids[] = ' .../i2c-ismt.c:202: warning: Function parameter or member 'dev' not described in '__ismt_desc_dump' .../i2c-ismt.c:202: warning: Function parameter or member 'desc' not described in '__ismt_desc_dump' .../i2c-ismt.c:649: warning: cannot understand function prototype: 'const struct i2c_algorithm smbus_algorithm = ' Fix corresponding descriptions to make reader and kernel doc validator happy. Signed-off-by:
Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by:
Seth Heasley <seth.heasley@linux.intel.com> Signed-off-by:
Wolfram Sang <wsa@kernel.org>
-
Paul Cercueil authored
CONFIG_OF is selected by CONFIG_MACH_INGENIC, therefore we don't need to handle the case where Device Tree is not supported. Signed-off-by:
Paul Cercueil <paul@crapouillou.net> Signed-off-by:
Wolfram Sang <wsa@kernel.org>
-
Paul Cercueil authored
The I2C controller in the JZ4770 SoC seems to work the exact same as in the JZ4780 SoC. Signed-off-by:
Paul Cercueil <paul@crapouillou.net> Signed-off-by:
Wolfram Sang <wsa@kernel.org>
-
Paul Cercueil authored
The I2C controller in the JZ4770 SoC seems to work the exact same as in the JZ4780 SoC. We could use "ingenic,jz4780-i2c" as a fallback string in the Device Tree, but that would be awkward, since the JZ4780 is newer. Instead, add a "ingenic,jz4770-i2c" string and use it as fallback for the "ingenic,jz4780-i2c" string. Signed-off-by:
Paul Cercueil <paul@crapouillou.net> Reviewed-by:
Rob Herring <robh@kernel.org> Signed-off-by:
Wolfram Sang <wsa@kernel.org>
-
Tom Rix authored
clang static analyzer reports this problem i2c-amd-mp2-plat.c:174:9: warning: Branch condition evaluates to a garbage value return err ? err : num; ^~~ err is not initialized, it depends on the being set in the transfer loop which will not happen if num is 0. Surveying other master_xfer() implementations show all handle a 0 num. Because returning 0 is expected, initialize err to 0. Signed-off-by:
Tom Rix <trix@redhat.com> Acked-by:
Elie Morisse <syniurge@gmail.com> Signed-off-by:
Wolfram Sang <wsa@kernel.org>
-
Krzysztof Kozlowski authored
Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and the error value gets printed. Signed-off-by:
Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by:
Alain Volmat <alain.volmat@st.com> Signed-off-by:
Wolfram Sang <wsa@kernel.org>
-
Alain Volmat authored
DMA usage is optional for the I2C driver. check for the -ENODEV error in order to avoid displaying an error when no DMA has been requested. Cleaning up the error messages during probe, remove the additional -EPROBE_DEFER within probe function since additional error message doesn't give much more information than what is already reported within the stm32_i2c_dma_request function. Signed-off-by:
Alain Volmat <alain.volmat@st.com> Signed-off-by:
Wolfram Sang <wsa@kernel.org>
-
Wolfram Sang authored
Slightly easier to read. Signed-off-by:
Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by:
Jean Delvare <jdelvare@suse.de> Signed-off-by:
Wolfram Sang <wsa@kernel.org>
-
Tian Tao authored
Switch to using the new API kobj_to_dev(). Signed-off-by:
Tian Tao <tiantao6@hisilicon.com> Signed-off-by:
Wolfram Sang <wsa@kernel.org>
-
Wolfram Sang authored
The I2C core can now utilize a slave interface to handle SMBus HostNotify events. Enable it in this driver. Signed-off-by:
Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by:
Wolfram Sang <wsa@kernel.org>
-
Wolfram Sang authored
Here is an I2C slave backend driver which allows to test some uncommon functionalities of the I2C and SMBus world. Usually, you need specific devices to test e.g. SMBus Host Notify and such. With this driver you just need the slave interface of another I2C controller. This initial version has testcases for multi-master and SMBus Host Notify. Already planned but not yet implemented are SMBus Alert and messages with I2C_M_RECV_LEN. Please read the documentation for further details. Signed-off-by:
Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by:
Wolfram Sang <wsa@kernel.org>
-
- 18 Sep, 2020 7 commits
-
-
Alain Volmat authored
Name slave slots in order to ease code maintenance. Signed-off-by:
Alain Volmat <alain.volmat@st.com> Signed-off-by:
Wolfram Sang <wsa@kernel.org>
-
Krzysztof Kozlowski authored
Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and the error value gets printed. Signed-off-by:
Krzysztof Kozlowski <krzk@kernel.org> Acked-by:
Florian Fainelli <f.fainelli@gmail.com> Signed-off-by:
Wolfram Sang <wsa@kernel.org>
-
Krzysztof Kozlowski authored
Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and the error value gets printed. Signed-off-by:
Krzysztof Kozlowski <krzk@kernel.org> Acked-by:
Peter Rosin <peda@axentia.se> Signed-off-by:
Wolfram Sang <wsa@kernel.org>
-
Krzysztof Kozlowski authored
Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and the error value gets printed. Signed-off-by:
Krzysztof Kozlowski <krzk@kernel.org> Acked-by:
Peter Rosin <peda@axentia.se> Signed-off-by:
Wolfram Sang <wsa@kernel.org>
-
Wolfram Sang authored
LOOP_TIMEOUT was only used back then because we didn't want to introduce another constant. The timeout value can easily be a magnitude shorter because the typical range is 3us - 8us. Refactor the code to use the poll_timeout helper, use a specific timeout value and get rid of the ugly LOOP_TIMEOUT constant. Signed-off-by:
Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by:
Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Signed-off-by:
Wolfram Sang <wsa@kernel.org>
-
Wolfram Sang authored
I2C doesn't define a timeout for bus busy, so an arbitrary value like LOOP_TIMEOUT is not a good idea. Let's use the timeout value in struct adapter which is meant for such cases and is user-configurable (via IOCTL). To reduce the load, wait 10us instead of 1us which is good enough for the slow frequencies used by I2C. Finally, use the poll_timeout helper instead of open coding it. Signed-off-by:
Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by:
Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Signed-off-by:
Wolfram Sang <wsa@kernel.org>
-
Alain Volmat authored
Rely on the core functions to implement the host-notify protocol via the a I2C slave device. Signed-off-by:
Alain Volmat <alain.volmat@st.com> Reviewed-by:
Pierre-Yves MORDRET <pierre-yves.mordret@st.com> Signed-off-by:
Wolfram Sang <wsa@kernel.org>
-
- 17 Sep, 2020 1 commit
-
-
Vadym Kochan authored
Set type as NVMEM_TYPE_EEPROM to expose this info via sysfs: $ cat /sys/bus/nvmem/devices/{DEVICE}/type EEPROM Signed-off-by:
Vadym Kochan <vadym.kochan@plvision.eu> Signed-off-by:
Bartosz Golaszewski <bgolaszewski@baylibre.com>
-
- 09 Sep, 2020 4 commits
-
-
Alain Volmat authored
SMBus Host-Notify protocol, from the adapter point of view consist of receiving a message from a client, including the client address and some other data. It can be simply handled by creating a new slave device and registering a callback performing the parsing of the message received from the client. This commit introduces two new core functions * i2c_new_slave_host_notify_device * i2c_free_slave_host_notify_device that take care of registration of the new slave device and callback and will call i2c_handle_smbus_host_notify once a Host-Notify event is received. Signed-off-by:
Alain Volmat <alain.volmat@st.com> Reviewed-by:
Pierre-Yves MORDRET <pierre-yves.mordret@st.com> Signed-off-by:
Wolfram Sang <wsa@kernel.org>
-
Wolfram Sang authored
SMBus is largely compatible with I2C but there are some specifics. In case we need them on a bus, we can now use this new binding. Signed-off-by:
Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by:
Wolfram Sang <wsa@kernel.org>
-
Anson Huang authored
dev_err_probe() can reduce code size, uniform error handling and record the defer probe reason etc., use it to simplify the code. Signed-off-by:
Anson Huang <Anson.Huang@nxp.com> Acked-by:
Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by:
Wolfram Sang <wsa@kernel.org>
-
Jeffrey Lin authored
Value of /sys/devices/platform/lis3lv02d/position when Horizontal: (36,-108,-1152) Left elevated: (-432,-126,-1062) Front elevated: (36,594,-936) Upside down: (-126,-252,1098) Signed-off-by:
Jeffrey Lin <jeffrey@icurse.nl> Reviewed-by:
Jean Delvare <jdelvare@suse.de> Signed-off-by:
Wolfram Sang <wsa@kernel.org>
-
- 28 Aug, 2020 3 commits
-
-
Dirk Behme authored
The i2c-rcar driver utilizes the Generic Reset Controller kernel feature, so select the RESET_CONTROLLER option when the I2C_RCAR option is selected with a Gen3 SoC. Fixes: 2b16fd63 ("i2c: rcar: handle RXDMA HW behaviour on Gen3") Signed-off-by:
Dirk Behme <dirk.behme@de.bosch.com> Signed-off-by:
Andy Lowe <andy_lowe@mentor.com> [erosca: Add "if ARCH_RCAR_GEN3" per Wolfram's request] Signed-off-by:
Eugeniu Rosca <erosca@de.adit-jv.com> Signed-off-by:
Wolfram Sang <wsa@kernel.org>
-
Jaakko Laine authored
I2C master operating in multimaster mode can get stuck indefinitely if I2C start is detected on bus, but no master has a transaction going. This is a weakness in I2C standard, which defines no way to recover, since all masters are indefinitely disallowed from interrupting the currently operating master. A start condition can be created for example by an electromagnetic discharge applied near physical I2C lines. Or a already operating master could get reset immediately after sending a start. If it is known during device tree creation that only a single I2C master will be present on the bus, this deadlock of the I2C bus could be avoided in the driver by ignoring the bus_is_busy register of the xiic, since bus can never be reserved by any other master. This patch adds this support for detecting single-master flag in device tree and when provided, improves I2C reliability by ignoring the therefore unnecessary xiic bus_is_busy register. Error can be reproduced by pulling I2C SDA -line temporarily low by shorting it to ground, while linux I2C master is operating on it using the xiic driver. The application using the bus will start receiving linux error code 16: "Device or resource busy" indefinitely: kernel: pca953x 0-0020: failed writing register app: Error writing file, error: 16 With multi-master disabled device will instead receive error code 5: "I/O error" while SDA is grounded, but recover normal operation once short is removed. kernel: pca953x 0-0020: failed reading register app: Error reading file, error: 5 Signed-off-by:
Jaakko Laine <ext-jaakko.laine@vaisala.com> Acked-by:
Michal Simek <michal.simek@xilinx.com> Signed-off-by:
Wolfram Sang <wsa@kernel.org>
-
Jaakko Laine authored
xiic_i2c struct alignment causes the struct to take more space in memory than strictly required. Move state -member to end of struct to get less padding. Signed-off-by:
Jaakko Laine <ext-jaakko.laine@vaisala.com> Suggested-by:
Michal Simek <michal.simek@xilinx.com> Acked-by:
Michal Simek <michal.simek@xilinx.com> Signed-off-by:
Wolfram Sang <wsa@kernel.org>
-