Re: [PATCH v11 1/7] i2c: add I2C Address Translator (ATR) support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Apr 21, 2023 at 01:18:27PM +0300, Tomi Valkeinen wrote:
> From: Luca Ceresoli <luca@xxxxxxxxxxxxxxxx>
> 
> An ATR is a device that looks similar to an i2c-mux: it has an I2C
> slave "upstream" port and N master "downstream" ports, and forwards
> transactions from upstream to the appropriate downstream port. But it
> is different in that the forwarded transaction has a different slave
> address. The address used on the upstream bus is called the "alias"
> and is (potentially) different from the physical slave address of the
> downstream chip.
> 
> Add a helper file (just like i2c-mux.c for a mux or switch) to allow
> implementing ATR features in a device driver. The helper takes care or
> adapter creation/destruction and translates addresses at each transaction.
> 
> Signed-off-by: Luca Ceresoli <luca@xxxxxxxxxxxxxxxx>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@xxxxxxxxxxxxxxxx>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> ---
>  .../devicetree/bindings/i2c/i2c-atr.yaml      |  34 +
>  Documentation/i2c/i2c-address-translators.rst |  96 +++
>  Documentation/i2c/index.rst                   |   1 +
>  MAINTAINERS                                   |   8 +
>  drivers/i2c/Kconfig                           |   9 +
>  drivers/i2c/Makefile                          |   1 +
>  drivers/i2c/i2c-atr.c                         | 684 ++++++++++++++++++
>  include/linux/i2c-atr.h                       | 116 +++
>  8 files changed, 949 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/i2c/i2c-atr.yaml
>  create mode 100644 Documentation/i2c/i2c-address-translators.rst
>  create mode 100644 drivers/i2c/i2c-atr.c
>  create mode 100644 include/linux/i2c-atr.h
> 
> diff --git a/Documentation/devicetree/bindings/i2c/i2c-atr.yaml b/Documentation/devicetree/bindings/i2c/i2c-atr.yaml
> new file mode 100644
> index 000000000000..d7f73d98110d
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/i2c/i2c-atr.yaml
> @@ -0,0 +1,34 @@
> +# SPDX-License-Identifier: GPL-2.0

Dual license.

> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/i2c/i2c-atr.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Common i2c address translator properties.

Drop hard stop.

> +
> +maintainers:
> +  - Tomi Valkeinen <tomi.valkeinen@xxxxxxxxxxxxxxxx>
> +
> +description:
> +  An I2C Address Translator (ATR) is a device with an I2C slave parent
> +  ("upstream") port and N I2C master child ("downstream") ports, and
> +  forwards transactions from upstream to the appropriate downstream port
> +  with a modified slave address. The address used on the parent bus is
> +  called the "alias" and is (potentially) different from the physical
> +  slave address of the child bus. Address translation is done by the
> +  hardware.
> +
> +properties:
> +  i2c-alias-pool:
> +    $ref: /schemas/types.yaml#/definitions/uint16-array

We do support some flags in the upper 16-bits of I2C addresses. Any of 
those possibly needed here?

> +    description:
> +      I2C alias pool is a pool of I2C addresses on the main I2C bus that can be
> +      used to access the remote peripherals on the serializer's I2C bus. The
> +      addresses must be available, not used by any other peripheral. Each
> +      remote peripheral is assigned an alias from the pool, and transactions to
> +      that address will be forwarded to the remote peripheral, with the address
> +      translated to the remote peripheral's real address. This property is not
> +      needed if there are no I2C addressable remote peripherals.
> +
> +additionalProperties: true
> +...




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux