Commit 6c3f98fa authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull i2c updates from Wolfram Sang:

 - the I2C core gained helpers to assist drivers in handling their
   suspended state, and drivers were converted to use it

 - two new fault-injectors for stress-testing

 - bigger refactoring and feature improvements for the ocores,
   sh_mobile, and tegra drivers

 - platform_data removal for the at24 EEPROM driver

 - ... and various improvements and bugfixes all over the subsystem

* 'i2c/for-5.1' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (69 commits)
  i2c: Allow recovery of the initial IRQ by an I2C client device.
  i2c: ocores: turn incomplete kdoc into a comment
  i2c: designware: Do not allow i2c_dw_xfer() calls while suspended
  i2c: tegra: Only display error messages if DMA setup fails
  i2c: gpio: fault-injector: add 'inject_panic' injector
  i2c: gpio: fault-injector: add 'lose_arbitration' injector
  i2c: tegra: remove multi-master support
  i2c: tegra: remove master fifo support on tegra186
  i2c: tegra: change phrasing, "fallbacking" to "falling back"
  i2c: expand minor range when registering chrdev region
  i2c: aspeed: Add multi-master use case support
  i2c: core-smbus: don't trace smbus_reply data on errors
  i2c: ocores: Add support for bus clock via platform data
  i2c: ocores: Add support for IO mapper registers.
  i2c: ocores: checkpatch fixes
  i2c: ocores: add SPDX tag
  i2c: ocores: add polling interface
  i2c: ocores: do not handle IRQ if IF is not set
  i2c: ocores: stop transfer on timeout
  i2c: tegra: add i2c interface timing support
  ...
parents 1cabd3e0 93b6604c
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -75,6 +75,8 @@ Optional properties:

  - address-width: number of address bits (one of 8, 16).

  - num-addresses: total number of i2c slave addresses this device takes

Example:

eeprom@52 {
@@ -82,4 +84,5 @@ eeprom@52 {
	reg = <0x52>;
	pagesize = <32>;
	wp-gpios = <&gpio1 3 0>;
	num-addresses = <8>;
};
+1 −0
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@ Required properties:
      "mediatek,mt6589-i2c": for MediaTek MT6589
      "mediatek,mt7622-i2c": for MediaTek MT7622
      "mediatek,mt7623-i2c", "mediatek,mt6577-i2c": for MediaTek MT7623
      "mediatek,mt7629-i2c", "mediatek,mt2712-i2c": for MediaTek MT7629
      "mediatek,mt8173-i2c": for MediaTek MT8173
  - reg: physical base address of the controller and dma base, length of memory
    mapped region.
+20 −0
Original line number Diff line number Diff line
i2c Controller on XScale platforms such as IOP3xx and IXP4xx

Required properties:
- compatible : Must be one of
  "intel,iop3xx-i2c"
  "intel,ixp4xx-i2c";
- reg
- #address-cells = <1>;
- #size-cells = <0>;

Optional properties:
- Child nodes conforming to i2c bus binding

Example:

i2c@c8011000 {
	compatible = "intel,ixp4xx-i2c";
	reg = <0xc8011000 0x18>;
	interrupts = <33 IRQ_TYPE_LEVEL_LOW>;
};
+4 −0
Original line number Diff line number Diff line
@@ -112,6 +112,10 @@ EPROTO
	case is when the length of an SMBus block data response
	(from the SMBus slave) is outside the range 1-32 bytes.

ESHUTDOWN
	Returned when a transfer was requested using an adapter
	which is already suspended.

ETIMEDOUT
	This is returned by drivers when an operation took too much
	time, and was aborted before it completed.
+58 −3
Original line number Diff line number Diff line
=========================
Linux I2C fault injection
=========================

@@ -13,6 +14,9 @@ mounted at /sys/kernel/debug. There will be a separate subdirectory per GPIO
driven I2C bus. Each subdirectory will contain files to trigger the fault
injection. They will be described now along with their intended use-cases.

Wire states
===========

"scl"
-----

@@ -34,10 +38,10 @@ I2C specification version 4, section 3.1.16) using the helpers of the Linux I2C
core (see 'struct bus_recovery_info'). However, the bus recovery will not
succeed because SDA is still pinned low until you manually release it again
with "echo 1 > sda". A test with an automatic release can be done with the
following class of fault injectors.
"incomplete transfers" class of fault injectors.

Introduction to incomplete transfers
------------------------------------
Incomplete transfers
====================

The following fault injectors create situations where SDA will be held low by a
device. Bus recovery should be able to fix these situations. But please note:
@@ -79,3 +83,54 @@ This is why bus recovery (up to 9 clock pulses) must either check SDA or send
additional STOP conditions to ensure the bus has been released. Otherwise
random data will be written to a device!

Lost arbitration
================

Here, we want to simulate the condition where the master under test loses the
bus arbitration against another master in a multi-master setup.

"lose_arbitration"
------------------

This file is write only and you need to write the duration of the arbitration
intereference (in µs, maximum is 100ms). The calling process will then sleep
and wait for the next bus clock. The process is interruptible, though.

Arbitration lost is achieved by waiting for SCL going down by the master under
test and then pulling SDA low for some time. So, the I2C address sent out
should be corrupted and that should be detected properly. That means that the
address sent out should have a lot of '1' bits to be able to detect corruption.
There doesn't need to be a device at this address because arbitration lost
should be detected beforehand. Also note, that SCL going down is monitored
using interrupts, so the interrupt latency might cause the first bits to be not
corrupted. A good starting point for using this fault injector on an otherwise
idle bus is:

# echo 200 > lose_arbitration &
# i2cget -y <bus_to_test> 0x3f

Panic during transfer
=====================

This fault injector will create a Kernel panic once the master under test
started a transfer. This usually means that the state machine of the bus master
driver will be ungracefully interrupted and the bus may end up in an unusual
state. Use this to check if your shutdown/reboot/boot code can handle this
scenario.

"inject_panic"
--------------

This file is write only and you need to write the delay between the detected
start of a transmission and the induced Kernel panic (in µs, maximum is 100ms).
The calling process will then sleep and wait for the next bus clock. The
process is interruptible, though.

Start of a transfer is detected by waiting for SCL going down by the master
under test.  A good starting point for using this fault injector is:

# echo 0 > inject_panic &
# i2cget -y <bus_to_test> <some_address>

Note that there doesn't need to be a device listening to the address you are
using. Results may vary depending on that, though.
Loading