mbox series

[v3,00/11] Add Mobileye EyeQ5 support to the Nomadik I2C controller & use hrtimers for timeouts

Message ID 20240306-mbly-i2c-v3-0-605f866aa4ec@bootlin.com (mailing list archive)
Headers show
Series Add Mobileye EyeQ5 support to the Nomadik I2C controller & use hrtimers for timeouts | expand

Message

Théo Lebrun March 6, 2024, 5:59 p.m. UTC
Hi,

This series adds two tangent features to the Nomadik I2C controller:

 - Add a new compatible to support Mobileye EyeQ5 which uses the same IP
   block as Nomadik.

   It has two quirks to be handled:
    - The memory bus only supports 32-bit accesses. Avoid readb() and
      writeb() calls that might generate byte load/store instructions.
    - We must write a value into a shared register region (OLB)
      depending on the I2C bus speed.

 - Allow xfer timeouts below one jiffy by using a waitqueue and hrtimers
   instead of a completion.

   The situation to be addressed is:
    - Many devices on the same I2C bus.
    - One xfer to each device is sent at regular interval.
    - One device gets stuck and does not answer.
    - With long timeouts, following devices won't get their message. A
      shorter timeout ensures we can still talk to the following
      devices.

   This clashes a bit with the current i2c_adapter timeout field that
   stores a jiffies amount. We therefore avoid it and store the value
   in a private struct field, as a µs amount. If the timeout is less
   than a jiffy duration, we switch from standard jiffies timeout to
   hrtimers.

About dependencies:
 - For testing on EyeQ5 hardware and devicetree patches, we need the
   base platform series from Grégory [0] and its dependency [1]. Both
   in mips-next [2].
 - Devicetree commits require the EyeQ5 syscon series [3] that provides
   the reset controller node.

Have a nice day,
Théo Lebrun

[0]: https://lore.kernel.org/lkml/20240216174227.409400-1-gregory.clement@bootlin.com/
[1]: https://lore.kernel.org/linux-mips/20240209-regname-v1-0-2125efa016ef@flygoat.com/
[2]: https://git.kernel.org/pub/scm/linux/kernel/git/mips/linux.git/log/
[3]: https://lore.kernel.org/lkml/20240301-mbly-clk-v9-0-cbf06eb88708@bootlin.com/

To: Linus Walleij <linus.walleij@linaro.org>
To: Andi Shyti <andi.shyti@kernel.org>
To: Rob Herring <robh+dt@kernel.org>
To: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
To: Conor Dooley <conor+dt@kernel.org>
To: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: <linux-arm-kernel@lists.infradead.org>
Cc: <linux-i2c@vger.kernel.org>
Cc: <devicetree@vger.kernel.org>
Cc: <linux-kernel@vger.kernel.org>
Cc: <linux-mips@vger.kernel.org>
Cc: Gregory Clement <gregory.clement@bootlin.com>
Cc: Vladimir Kondratiev <vladimir.kondratiev@mobileye.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: Tawfik Bayouk <tawfik.bayouk@mobileye.com>
Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>

Changes in v3:
- dt-bindings:
  - hwmon: lm75: drop patch taken into hwmon-next.
  - i2c: nomadik: remove superfluous "The variant found in..." comments.
- i2c: nomadik:
  - Add style fixes description in commit message of "rename private
    struct pointers from dev to priv".
  - Improve commit message of "simplify IRQ masking logic".
  - introduce ADR_3MSB_BITS constant to avoid magic GENMASK() in code.
  - Introduce enum i2c_operating_mode to avoid magic 0b01 in
    DEFAULT_I2C_REG_CR. Named as in manual, using outdated terms.
  - i2c_irq_handler(): add newline and split declaration and assignment
    in I2C_IT_BERR case.
  - Make timeout_usecs an u32 rather than int; avoid superfluous cast.
  - nmk_i2c_probe(): remove extraneous debug log.
  - nmk_i2c_eyeq5_probe():
    - Straight return error and remove useless handling of NULL. Put
      dev_err_probe() call in probe().
    - Add ID value check.
    - Add enum for speed mode values.
    - Add static array for masks.
  - Reorder includes in separate commit from Mobileye support.
- Take trailers from Andi, Wolfram and Linus.
- Link to v2: https://lore.kernel.org/r/20240229-mbly-i2c-v2-0-b32ed18c098c@bootlin.com

Changes in v2:
- dt-bindings: i2c: st,nomadic-i2c:
  - Drop timeout-usecs property, rely on generic i2c-transfer-timeout-us.
  - Use phandle to syscon with cell args; remove mobileye,id prop; move
    mobileye,olb from if-statement to top-level.
- dt-bindings: hwmon: lm75:
  - Inherit from hwmon-common.yaml rather than declare generic label property.
- i2c: nomadik: (ie driver code)
  - Parse i2c-transfer-timeout-us rather than custom timeout-usecs property.
  - Introduce readb/writeb helpers with fallback to readl/writel.
  - Avoid readb() on Mobileye.
  - Use mobileye,olb cell args to get controller index rather than mobileye,id.
  - Take 5 Reviewed-by Linus Walleij.
- MIPS: mobileye: (ie devicetrees)
  - Use mobileye,olb with cell args rather than mobileye,id.
  - Squash reset commit.
  - Add i2c-transfer-timeout-us value of 10ms to all controllers.
  - Rename LM75 instance from tmp112@48 to temperature-sensor@48.
- Link to v1: https://lore.kernel.org/r/20240215-mbly-i2c-v1-0-19a336e91dca@bootlin.com

---
Théo Lebrun (11):
      dt-bindings: i2c: nomadik: add mobileye,eyeq5-i2c bindings and example
      i2c: nomadik: rename private struct pointers from dev to priv
      i2c: nomadik: simplify IRQ masking logic
      i2c: nomadik: use bitops helpers
      i2c: nomadik: support short xfer timeouts using waitqueue & hrtimer
      i2c: nomadik: replace jiffies by ktime for FIFO flushing timeout
      i2c: nomadik: fetch i2c-transfer-timeout-us property from devicetree
      i2c: nomadik: support Mobileye EyeQ5 I2C controller
      i2c: nomadik: sort includes
      MIPS: mobileye: eyeq5: add 5 I2C controller nodes
      MIPS: mobileye: eyeq5: add evaluation board I2C temp sensor

 .../devicetree/bindings/i2c/st,nomadik-i2c.yaml    |  49 +-
 arch/mips/boot/dts/mobileye/eyeq5-epm5.dts         |   8 +
 arch/mips/boot/dts/mobileye/eyeq5.dtsi             |  75 +++
 drivers/i2c/busses/i2c-nomadik.c                   | 740 ++++++++++++---------
 4 files changed, 558 insertions(+), 314 deletions(-)
---
base-commit: 70a29ee8ef53a09ab62b46540c12ccb94a4a8532
change-id: 20231023-mbly-i2c-7c2fbbb1299f

Best regards,

Comments

Andi Shyti March 8, 2024, 10:52 p.m. UTC | #1
Hi

On Wed, 06 Mar 2024 18:59:20 +0100, Théo Lebrun wrote:
> This series adds two tangent features to the Nomadik I2C controller:
> 
>  - Add a new compatible to support Mobileye EyeQ5 which uses the same IP
>    block as Nomadik.
> 
>    It has two quirks to be handled:
>     - The memory bus only supports 32-bit accesses. Avoid readb() and
>       writeb() calls that might generate byte load/store instructions.
>     - We must write a value into a shared register region (OLB)
>       depending on the I2C bus speed.
> 
> [...]

Applied to i2c/i2c-host on

git://git.kernel.org/pub/scm/linux/kernel/git/andi.shyti/linux.git

Thank you,
Andi

Patches applied
===============
[01/11] dt-bindings: i2c: nomadik: add mobileye,eyeq5-i2c bindings and example
        commit: 1b9a8e8af0d969ad8f2deece827e691a1b07ba1b
[02/11] i2c: nomadik: rename private struct pointers from dev to priv
        commit: ae9977eefc4a1e6e8fda619f5b8734efb6f11b58
[03/11] i2c: nomadik: simplify IRQ masking logic
        commit: 43f58f3e4b6678f7138461e17a37eb3aed223bf5
[04/11] i2c: nomadik: use bitops helpers
        commit: 9ab4b2a4faf459514f2c84c5302b207b4bb8b1e1
[05/11] i2c: nomadik: support short xfer timeouts using waitqueue & hrtimer
        commit: 127b87a5d11571932ea7f4d8115f4effc2f110a8
[06/11] i2c: nomadik: replace jiffies by ktime for FIFO flushing timeout
        commit: 0aaab5ad3a615bab4e1d401f545f77889377fffd
[07/11] i2c: nomadik: fetch i2c-transfer-timeout-us property from devicetree
        commit: 0148feec0a51445d29a773e55bc8be9aa3b61a8f
[08/11] i2c: nomadik: support Mobileye EyeQ5 I2C controller
        commit: 983548d0e62a93146f35185e6c49e568b05fb44d
[09/11] i2c: nomadik: sort includes
        commit: e275c0cf70e47304bc63c050c14129237c588123