Skip to contentSkip to conversation

Add the I3C subsystem

PATCH Superseded Boris Brezillon 6 participants 34 messages Mar 23, 2018 – Mar 28, 2018

Subsystems (7)

v3 of 10 Superseded Latest is v10 →

lore
Share & tools
lore
#0 lore raw

v3 cover Add the I3C subsystem

This patch series is a proposal for a new I3C [1] subsystem.

This infrastructure is not complete yet and will be extended over time.

There are a few design choices that are worth mentioning because they impact the way I3C device drivers can interact with their devices:

- all functions used to send I3C/I2C frames must be called in non-atomic context. Mainly done this way to ease implementation, but this is still open to discussion. Please let me know if you think it's worth considering an asynchronous model here
- the bus element is a separate object and is not implicitly described by the master (as done in I2C). The reason is that I want to be able to handle multiple master connected to the same bus and visible to Linux.
In this situation, we should only have one instance of the device and not one per master, and sharing the bus object would be part of the solution to gracefully handle this case.
I'm not sure if we will ever need to deal with multiple masters controlling the same bus and exposed under Linux, but separating the bus and master concept is pretty easy, hence the decision to do it now, just in case we need it some day.
The other benefit of separating the bus and master concepts is that master devices appear under the bus directory in sysfs.
- I2C backward compatibility has been designed to be transparent to I2C drivers and the I2C subsystem. The I3C master just registers an I2C adapter which creates a new I2C bus. I'd say that, from a representation PoV it's not ideal because what should appear as a single I3C bus exposing I3C and I2C devices here appears as 2 different busses connected to each other through the parenting (the I3C master is the parent of the I2C and I3C busses).
On the other hand, I don't see a better solution if we want something that is not invasive.

Missing features in this preliminary version:
- support for HDR modes (has been removed because of lack of real users)
- no support for multi-master and the associated concepts (mastership handover, support for secondary masters, ...)
- I2C devices can only be described using DT because this is the only use case I have. However, the framework can easily be extended with ACPI and board info support
- I3C slave framework. This has been completely omitted, but shouldn't have a huge impact on the I3C framework because I3C slaves don't see the whole bus, it's only about handling master requests and generating IBIs. Some of the struct, constant and enum definitions could be shared, but most of the I3C slave framework logic will be different

Main changes between v2 and v3 are:
- Reworked the DT bindings as suggested by Rob
- Reworked the bus initialization step as suggested by Vitor
- Added a driver for an I3C GPIO expander

Main changes between the initial RFC and this v2 are:
- Add a generic infrastructure to support IBIs. It's worth mentioning that I tried exposing IBIs as a regular IRQs, but after several attempts and a discussion with Mark Zyngier, it appeared that it was not really fitting in the Linux IRQ model (the fact that you have payload attached to IBIs, the fact that most of the time an IBI will generate a transfer on the bus which has to be done in an atomic context, ...)
The counterpart of this decision is the latency induced by the workqueue approach, but since I don't have real use cases, I don't know if this can be a problem or not.
- Add helpers to support Hot Join
- Add support for IBIs and Hot Join in Cadence I3C master driver
- Address several issues in how I was using the device model

I'll finish on a good news: this week the MIPI alliance opened the I3C spec. So everyone can now review the patches (no need to be member of the MIPI I3C group).
I'll let you find the link in the doc, this way maybe I'll have reviews on the doc itself :-).

Thanks,

Boris

Boris Brezillon (11):
i2c: Export of_i2c_get_board_info()
i3c: Add core I3C infrastructure
docs: driver-api: Add I3C documentation
i3c: Add sysfs ABI spec
dt-bindings: i3c: Document core bindings
dt-bindings: i3c: Add macros to help fill I3C/I2C device's reg
property
MAINTAINERS: Add myself as the I3C subsystem maintainer
i3c: master: Add driver for Cadence IP
dt-bindings: i3c: Document Cadence I3C master bindings
gpio: Add a driver for Cadence I3C GPIO expander
dt-bindings: gpio: Add bindings for Cadence I3C gpio expander

 Documentation/ABI/testing/sysfs-bus-i3c            |   95 ++
 .../devicetree/bindings/gpio/gpio-cdns-i3c.txt     |   38 +
 .../devicetree/bindings/i3c/cdns,i3c-master.txt    |   45 +
 Documentation/devicetree/bindings/i3c/i3c.txt      |  140 ++
 Documentation/driver-api/i3c/conf.py               |   10 +
 Documentation/driver-api/i3c/device-driver-api.rst |    7 +
 Documentation/driver-api/i3c/index.rst             |    9 +
 Documentation/driver-api/i3c/master-driver-api.rst |    8 +
 Documentation/driver-api/i3c/protocol.rst          |  201 +++
 Documentation/driver-api/index.rst                 |    1 +
 MAINTAINERS                                        |    9 +
 drivers/Kconfig                                    |    2 +
 drivers/Makefile                                   |    2 +-
 drivers/gpio/Kconfig                               |   11 +
 drivers/gpio/Makefile                              |    1 +
 drivers/gpio/gpio-cdns-i3c.c                       |  380 +++++
 drivers/i2c/i2c-core-base.c                        |    2 +-
 drivers/i2c/i2c-core-of.c                          |   66 +-
 drivers/i3c/Kconfig                                |   24 +
 drivers/i3c/Makefile                               |    4 +
 drivers/i3c/core.c                                 |  620 +++++++
 drivers/i3c/device.c                               |  294 ++++
 drivers/i3c/internals.h                            |   28 +
 drivers/i3c/master.c                               | 1723 ++++++++++++++++++++
 drivers/i3c/master/Kconfig                         |    5 +
 drivers/i3c/master/Makefile                        |    1 +
 drivers/i3c/master/i3c-master-cdns.c               | 1648 +++++++++++++++++++
 include/dt-bindings/i3c/i3c.h                      |   28 +
 include/linux/i2c.h                                |   10 +
 include/linux/i3c/ccc.h                            |  382 +++++
 include/linux/i3c/device.h                         |  305 ++++
 include/linux/i3c/master.h                         |  587 +++++++
 include/linux/mod_devicetable.h                    |   17 +
 33 files changed, 6673 insertions(+), 30 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-i3c
 create mode 100644 Documentation/devicetree/bindings/gpio/gpio-cdns-i3c.txt
 create mode 100644 Documentation/devicetree/bindings/i3c/cdns,i3c-master.txt
 create mode 100644 Documentation/devicetree/bindings/i3c/i3c.txt
 create mode 100644 Documentation/driver-api/i3c/conf.py
 create mode 100644 Documentation/driver-api/i3c/device-driver-api.rst
 create mode 100644 Documentation/driver-api/i3c/index.rst
 create mode 100644 Documentation/driver-api/i3c/master-driver-api.rst
 create mode 100644 Documentation/driver-api/i3c/protocol.rst
 create mode 100644 drivers/gpio/gpio-cdns-i3c.c
 create mode 100644 drivers/i3c/Kconfig
 create mode 100644 drivers/i3c/Makefile
 create mode 100644 drivers/i3c/core.c
 create mode 100644 drivers/i3c/device.c
 create mode 100644 drivers/i3c/internals.h
 create mode 100644 drivers/i3c/master.c
 create mode 100644 drivers/i3c/master/Kconfig
 create mode 100644 drivers/i3c/master/Makefile
 create mode 100644 drivers/i3c/master/i3c-master-cdns.c
 create mode 100644 include/dt-bindings/i3c/i3c.h
 create mode 100644 include/linux/i3c/ccc.h
 create mode 100644 include/linux/i3c/device.h
 create mode 100644 include/linux/i3c/master.h
Signature · 1 line
2.14.1
#1 lore raw

PATCH v3 1/11 i2c: Export of_i2c_get_board_info()

From: Boris Brezillon <[email protected]>

I3C busses have to know about all I2C devices connected on the I3C bus to properly initialize the I3C master, and I2C frames can't be sent on the bus until this initialization is done.

We can't let the I2C core parse the DT and instantiate I2C devices as part of its i2c_add_adapter() procedure because, when done this way, I2C devices are directly registered to the device-model and might be attached to drivers which could in turn start sending frames on the bus, which won't work since, as said above, the bus is not yet initialized.

Export of_i2c_register_device() in order to let the I3C core parse the I2C device nodes by itself and initialize the bus.

---
Changes in v2:
- fix memset() call
- rebase on v4.15-rc1

---
 drivers/i2c/i2c-core-base.c |  2 +-
 drivers/i2c/i2c-core-of.c   | 66 ++++++++++++++++++++++++++-------------------
 include/linux/i2c.h         | 10 +++++++
 3 files changed, 49 insertions(+), 29 deletions(-)
drivers/i2c/i2c-core-base.c +1 -1
index 5a00bf443d06..e57715f5064c 100644
@@ -736,7 +736,7 @@ i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info)
 	client->dev.parent = &client->adapter->dev;
 	client->dev.bus = &i2c_bus_type;
 	client->dev.type = &i2c_client_type;
-	client->dev.of_node = info->of_node;
+	client->dev.of_node = of_node_get(info->of_node);
 	client->dev.fwnode = info->fwnode;
 
 	i2c_dev_set_name(adap, client, info);
drivers/i2c/i2c-core-of.c +38 -28

94 lines not on this page · raw message

include/linux/i2c.h +10 -0
index 419a38e7c315..3e38c10748e3 100644
@@ -873,6 +873,9 @@ extern const struct of_device_id
 *i2c_of_match_device(const struct of_device_id *matches,
 		     struct i2c_client *client);
 
+int of_i2c_get_board_info(struct device *dev, struct device_node *node,
+			  struct i2c_board_info *info);
+
 #else
 
 static inline struct i2c_client *of_find_i2c_device_by_node(struct device_node *node)
@@ -897,6 +900,13 @@ static inline const struct of_device_id
 	return NULL;
 }
 
+static inline int of_i2c_get_board_info(struct device *dev,
+					struct device_node *node,
+					struct i2c_board_info *info)
+{
+	return -ENOTSUPP;
+}
+
 #endif /* CONFIG_OF */
 
 #if IS_ENABLED(CONFIG_ACPI)
Signature · 1 line
2.14.1
#6 lore raw

PATCH v3 2/11 i3c: Add core I3C infrastructure

In reply to Boris Brezillon

From: Boris Brezillon <[email protected]>

Add core infrastructure to support I3C in Linux and document it.

This infrastructure is not complete yet and will be extended over time.

There are a few design choices that are worth mentioning because they impact the way I3C device drivers can interact with their devices:

- all functions used to send I3C/I2C frames must be called in non-atomic context. Mainly done this way to ease implementation, but this is still open to discussion. Please let me know if you think it's worth considering an asynchronous model here
- the bus element is a separate object and is not implicitly described by the master (as done in I2C). The reason is that I want to be able to handle multiple master connected to the same bus and visible to Linux.
In this situation, we should only have one instance of the device and not one per master, and sharing the bus object would be part of the solution to gracefully handle this case.
I'm not sure we will ever need to deal with multiple masters controlling the same bus and exposed under Linux, but separating the bus and master concept is pretty easy, hence the decision to do it like that.
The other benefit of separating the bus and master concepts is that master devices appear under the bus directory in sysfs.
- I2C backward compatibility has been designed to be transparent to I2C drivers and the I2C subsystem. The I3C master just registers an I2C adapter which creates a new I2C bus. I'd say that, from a representation PoV it's not ideal because what should appear as a single I3C bus exposing I3C and I2C devices here appears as 2 different busses connected to each other through the parenting (the I3C master is the parent of the I2C and I3C busses).
On the other hand, I don't see a better solution if we want something that is not invasive.

Missing features in this preliminary version:
- I3C HDR modes are not supported
- no support for multi-master and the associated concepts (mastership handover, support for secondary masters, ...)
- I2C devices can only be described using DT because this is the only use case I have. However, the framework can easily be extended with ACPI and board info support
- I3C slave framework. This has been completely omitted, but shouldn't have a huge impact on the I3C framework because I3C slaves don't see the whole bus, it's only about handling master requests and generating IBIs. Some of the struct, constant and enum definitions could be shared, but most of the I3C slave framework logic will be different

---
Changes in v3:
- Fix locking issues
- Explicitly include a bunch of headers (reported by Randy Dunlap)
- Rename {i2c,i3c}-scl-frequency DT prop into {i2c,i3c}-scl-hz
- Do not use BIT() macro in mod_devicetable.h
- Fix typos
- Fix/enhance some kernel doc headers
- Rework the bus initialization code to simplify master drivers
- Assign dynamic address with SETDASA if the device has a static address and the DT has a valid assigned-address property
- Rework the LVR extraction in DT parsing code
- Add code to detect when a device is re-attached to the bus after losing its dynamic address. In this case we know try to re-assign the old address, and most importantly, the I3C device driver sees the same device instance, not a new one
- Add an ->i2c_funcs() hook to let the master declare which I2C features it supports
- Unexport a few functions
- Remove support for HDR mode since we have no real user yet

Changes in v2:
- Fix a bunch of mistake I made with the device model (pointed by GKH)
- Move the documentation out of this commit (pointed by GKH)
- only source drivers/i3c/master/Kconfig when CONFIG_I3C is enabled (pointed by GKH)
- Add IBI infrastructure
- Add helpers to ease support for Hot Join (most of the logic is delegated to I3C controller drivers)
- move the doc out of this commit to improve readability
- Fix a few bugs in device probing/remove (detected after trying to load/unload modules in various orders)
- Add a module_i3c_i2c_driver() macro to ease integration of drivers for devices that support both I3C and I2C mode

---
 drivers/Kconfig                 |    2 +
 drivers/Makefile                |    2 +-
 drivers/i3c/Kconfig             |   24 +
 drivers/i3c/Makefile            |    4 +
 drivers/i3c/core.c              |  620 ++++++++++++++
 drivers/i3c/device.c            |  294 +++++++
 drivers/i3c/internals.h         |   28 +
 drivers/i3c/master.c            | 1723 +++++++++++++++++++++++++++++++++++++++
 drivers/i3c/master/Kconfig      |    0
 drivers/i3c/master/Makefile     |    0
 include/linux/i3c/ccc.h         |  382 +++++++++
 include/linux/i3c/device.h      |  305 +++++++
 include/linux/i3c/master.h      |  587 +++++++++++++
 include/linux/mod_devicetable.h |   17 +
 14 files changed, 3987 insertions(+), 1 deletion(-)
 create mode 100644 drivers/i3c/Kconfig
 create mode 100644 drivers/i3c/Makefile
 create mode 100644 drivers/i3c/core.c
 create mode 100644 drivers/i3c/device.c
 create mode 100644 drivers/i3c/internals.h
 create mode 100644 drivers/i3c/master.c
 create mode 100644 drivers/i3c/master/Kconfig
 create mode 100644 drivers/i3c/master/Makefile
 create mode 100644 include/linux/i3c/ccc.h
 create mode 100644 include/linux/i3c/device.h
 create mode 100644 include/linux/i3c/master.h
drivers/Kconfig +2 -0
index 879dc0604cba..f0563ce52fab 100644
@@ -55,6 +55,8 @@ source "drivers/char/Kconfig"
 
 source "drivers/i2c/Kconfig"
 
+source "drivers/i3c/Kconfig"
+
 source "drivers/spi/Kconfig"
 
 source "drivers/spmi/Kconfig"
drivers/Makefile +1 -1
index 24cd47014657..999239dc29d4 100644
@@ -111,7 +111,7 @@ obj-$(CONFIG_SERIO)		+= input/serio/
 obj-$(CONFIG_GAMEPORT)		+= input/gameport/
 obj-$(CONFIG_INPUT)		+= input/
 obj-$(CONFIG_RTC_LIB)		+= rtc/
-obj-y				+= i2c/ media/
+obj-y				+= i2c/ i3c/ media/
 obj-$(CONFIG_PPS)		+= pps/
 obj-y				+= ptp/
 obj-$(CONFIG_W1)		+= w1/
drivers/i3c/Kconfig new file +24 -0
new file mode 100644
index 000000000000..cf3752412ae9
@@ -0,0 +1,24 @@
+# SPDX-License-Identifier: GPL-2.0
+
+menuconfig I3C
+	tristate "I3C support"
+	select I2C
+	help
+	  I3C is a serial protocol standardized by the MIPI alliance.
+
+	  It's supposed to be backward compatible with I2C while providing
+	  support for high speed transfers and native interrupt support
+	  without the need for extra pins.
+
+	  The I3C protocol also standardizes the slave device types and is
+	  mainly design to communicate with sensors.
+
+	  If you want I3C support, you should say Y here and also to the
+	  specific driver for your bus adapter(s) below.
+
+	  This I3C support can also be built as a module.  If so, the module
+	  will be called i3c.
+
+if I3C
+source "drivers/i3c/master/Kconfig"
+endif # I3C
drivers/i3c/Makefile new file +4 -0
new file mode 100644
index 000000000000..3b6d1502d6e6
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0
+i3c-y				:= core.o device.o master.o
+obj-$(CONFIG_I3C)		+= i3c.o
+obj-$(CONFIG_I3C)		+= master/
drivers/i3c/core.c new file +620 -0

620 lines not on this page · raw message

drivers/i3c/device.c new file +294 -0

294 lines not on this page · raw message

drivers/i3c/internals.h new file +28 -0
new file mode 100644
index 000000000000..8730c6d04ccf
@@ -0,0 +1,28 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2017 Cadence Design Systems Inc.
+ *
+ * Author: Boris Brezillon <[email protected]>
+ */
+
+#ifndef I3C_INTERNALS_H
+#define I3C_INTERNALS_H
+
+#include <linux/i3c/master.h>
+
+extern struct bus_type i3c_bus_type;
+extern const struct device_type i3c_master_type;
+extern const struct device_type i3c_device_type;
+
+void i3c_bus_unref(struct i3c_bus *bus);
+struct i3c_bus *i3c_bus_create(struct device *parent);
+void i3c_bus_unregister(struct i3c_bus *bus);
+int i3c_bus_register(struct i3c_bus *i3cbus);
+int i3c_bus_get_free_addr(struct i3c_bus *bus, u8 start_addr);
+bool i3c_bus_dev_addr_is_avail(struct i3c_bus *bus, u8 addr);
+void i3c_bus_set_addr_slot_status(struct i3c_bus *bus, u16 addr,
+				  enum i3c_addr_slot_status status);
+enum i3c_addr_slot_status i3c_bus_get_addr_slot_status(struct i3c_bus *bus,
+						       u16 addr);
+
+#endif /* I3C_INTERNAL_H */
drivers/i3c/master.c new file +1723 -0

1,723 lines not on this page · raw message

drivers/i3c/master/Kconfig new file +0 -0
new file mode 100644
index 000000000000..e69de29bb2d1
drivers/i3c/master/Makefile new file +0 -0
new file mode 100644
index 000000000000..e69de29bb2d1
include/linux/i3c/ccc.h new file +382 -0

291 lines not on this page · raw message

include/linux/i3c/device.h new file +305 -0

305 lines not on this page · raw message

include/linux/i3c/master.h new file +587 -0

587 lines not on this page · raw message

include/linux/mod_devicetable.h +17 -0
index 48fb2b43c35a..ba4a7a263bf5 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.14.1

Part of the diff is not shown here. View the raw message.

#7 lore raw

PATCH v3 3/11 docs: driver-api: Add I3C documentation

In reply to Boris Brezillon

From: Boris Brezillon <[email protected]>

Add the I3C documentation describing the protocol, the master driver API and the device driver API.

---
Changes in v2:
- Moved out of patch "i3c: Add core I3C infrastructure"
- Add link to the I3C spec
- Move rst files in Documentation/driver-api/i3c/

---
 Documentation/driver-api/i3c/conf.py               |  10 +
 Documentation/driver-api/i3c/device-driver-api.rst |   7 +
 Documentation/driver-api/i3c/index.rst             |   9 +
 Documentation/driver-api/i3c/master-driver-api.rst |   8 +
 Documentation/driver-api/i3c/protocol.rst          | 201 +++++++++++++++++++++
 Documentation/driver-api/index.rst                 |   1 +
 6 files changed, 236 insertions(+)
 create mode 100644 Documentation/driver-api/i3c/conf.py
 create mode 100644 Documentation/driver-api/i3c/device-driver-api.rst
 create mode 100644 Documentation/driver-api/i3c/index.rst
 create mode 100644 Documentation/driver-api/i3c/master-driver-api.rst
 create mode 100644 Documentation/driver-api/i3c/protocol.rst
Documentation/driver-api/i3c/conf.py new file +10 -0
new file mode 100644
index 000000000000..5a20832d59a7
@@ -0,0 +1,10 @@
+# -*- coding: utf-8; mode: python -*-
+
+project = "Linux I3C Subsystem"
+
+tags.add("subproject")
+
+latex_documents = [
+    ('index', 'i3c.tex', project,
+     'The kernel development community', 'manual'),
+]
Documentation/driver-api/i3c/device-driver-api.rst new file +7 -0
new file mode 100644
index 000000000000..63c843f148a6
@@ -0,0 +1,7 @@
+=====================
+I3C device driver API
+=====================
+
+.. kernel-doc:: include/linux/i3c/device.h
+
+.. kernel-doc:: drivers/i3c/device.c
Documentation/driver-api/i3c/index.rst new file +9 -0
new file mode 100644
index 000000000000..9c439220439d
@@ -0,0 +1,9 @@
+=============
+I3C subsystem
+=============
+
+.. toctree::
+
+   protocol
+   device-driver-api
+   master-driver-api
Documentation/driver-api/i3c/master-driver-api.rst new file +8 -0
new file mode 100644
index 000000000000..017e7711cdf7
@@ -0,0 +1,8 @@
+================================
+I3C master controller driver API
+================================
+
+.. kernel-doc:: drivers/i3c/master.c
+
+.. kernel-doc:: include/linux/i3c/master.h
+
Documentation/driver-api/i3c/protocol.rst new file +201 -0

201 lines not on this page · raw message

Documentation/driver-api/index.rst +1 -0
index e9b41b1634f3..2563a4e19e08 100644
@@ -30,6 +30,7 @@ available subsections can be seen below.
    pci
    spi
    i2c
+   i3c/index
    hsi
    edac
    scsi
Signature · 1 line
2.14.1
#8 lore raw

PATCH v3 4/11 i3c: Add sysfs ABI spec

In reply to Boris Brezillon

From: Boris Brezillon <[email protected]>

Document sysfs files/directories/symlinks exposed by the I3C subsystem.

---
Changes in v2:
- new patch

---
 Documentation/ABI/testing/sysfs-bus-i3c | 95 +++++++++++++++++++++++++++++++++
 1 file changed, 95 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-i3c
Documentation/ABI/testing/sysfs-bus-i3c new file +95 -0
new file mode 100644
index 000000000000..5e88cc093e0e
@@ -0,0 +1,95 @@
+What:		/sys/bus/i3c/devices/i3c-<bus-id>
+KernelVersion:  4.16
+Contact:	[email protected]
+Description:
+		An I3C bus. This directory will contain one sub-directory per
+		I3C device present on the bus.
+
+What:		/sys/bus/i3c/devices/i3c-<bus-id>/current_master
+KernelVersion:  4.16
+Contact:	[email protected]
+Description:
+		Expose the master that owns the bus (<bus-id>-<master-pid>) at
+		the time this file is read. Note that bus ownership can change
+		overtime, so there's no guarantee that when the read() call
+		returns, the value returned is still valid.
+
+What:		/sys/bus/i3c/devices/i3c-<bus-id>/mode
+KernelVersion:  4.16
+Contact:	[email protected]
+Description:
+		I3C bus mode. Can be "pure", "mixed-fast" or "mixed-slow". See
+		the I3C specification for a detailed description of what each
+		of these modes implies.
+
+What:		/sys/bus/i3c/devices/i3c-<bus-id>/i3c_scl_frequency
+KernelVersion:  4.16
+Contact:	[email protected]
+Description:
+		The frequency (expressed in Hz) of the SCL signal when
+		operating in I3C SDR mode.
+
+What:		/sys/bus/i3c/devices/i3c-<bus-id>/i2c_scl_frequency
+KernelVersion:  4.16
+Contact:	[email protected]
+Description:
+		The frequency (expressed in Hz) of the SCL signal when
+		operating in I2C mode.
+
+What:		/sys/bus/i3c/devices/i3c-<bus-id>/<bus-id>-<device-pid>
+KernelVersion:  4.16
+Contact:	[email protected]
+Description:
+		An I3C device present on I3C bus identified by <bus-id>. Note
+		that all devices are represented including the master driving
+		the bus.
+
+What:		/sys/bus/i3c/devices/i3c-<bus-id>/<bus-id>-<device-pid>/address
+KernelVersion:  4.16
+Contact:	[email protected]
+Description:
+		Dynamic address assigned to device <bus-id>-<device-pid>. This
+		address may change if the bus is re-initialized.
+
+What:		/sys/bus/i3c/devices/i3c-<bus-id>/<bus-id>-<device-pid>/bcr
+KernelVersion:  4.16
+Contact:	[email protected]
+Description:
+		BCR stands for Bus Characteristics Register and express the
+		device capabilities in term of speed, maximum read/write
+		length, etc. See the I3C specification for more details.
+
+What:		/sys/bus/i3c/devices/i3c-<bus-id>/<bus-id>-<device-pid>/dcr
+KernelVersion:  4.16
+Contact:	[email protected]
+Description:
+		DCR stands for Device Characteristics Register and express the
+		device capabilities in term of exposed features. See the I3C
+		specification for more details.
+
+What:		/sys/bus/i3c/devices/i3c-<bus-id>/<bus-id>-<device-pid>/pid
+KernelVersion:  4.16
+Contact:	[email protected]
+Description:
+		PID stands for Provisional ID and is used to uniquely identify
+		a device on a bus. This PID contains information about the
+		vendor, the part and an instance ID so that several devices of
+		the same type can be connected on the same bus.
+		See the I3C specification for more details.
+
+What:		/sys/bus/i3c/devices/i3c-<bus-id>/<bus-id>-<device-pid>/hdrcap
+KernelVersion:  4.16
+Contact:	[email protected]
+Description:
+		Expose the HDR (High Data Rate) capabilities of a device.
+		Returns a list of supported HDR mode, each element is separated
+		by space. Modes can be "hdr-ddr", "hdr-tsp" and "hdr-tsl".
+		See the I3C specification for more details about these HDR
+		modes.
+
+What:		/sys/bus/i3c/devices/<bus-id>-<device-pid>
+KernelVersion:  4.16
+Contact:	[email protected]
+Description:
+		These directories are just symbolic links to
+		/sys/bus/i3c/devices/i3c-<bus-id>/<bus-id>-<device-pid>.
Signature · 1 line
2.14.1
#9 lore raw

PATCH v3 5/11 dt-bindings: i3c: Document core bindings

In reply to Boris Brezillon

From: Boris Brezillon <[email protected]>

A new I3C subsystem has been added and a generic description has been created to represent the I3C bus and the devices connected on it.

Document this generic representation.

---
Changes in v3:
- Rename {i2c,i3c}-scl-frequency DT prop into {i2c,i3c}-scl-hz
- Rework the way we expose the provisional ID and LVR information
- Rename dynamic-address into assigned-address
- Enforce the I3C master node name

Changes in v2:
- Define how to describe I3C devices in the DT and when it should be used. Note that the parsing of I3C devices is not yet implemented in the framework. Will be added when someone really needs it.

---
 Documentation/devicetree/bindings/i3c/i3c.txt | 140 ++++++++++++++++++++++++++
 1 file changed, 140 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/i3c/i3c.txt
Documentation/devicetree/bindings/i3c/i3c.txt new file +140 -0
new file mode 100644
index 000000000000..ed858228d26b
@@ -0,0 +1,140 @@
+Generic device tree bindings for I3C busses
+===========================================
+
+This document describes generic bindings that should be used to describe I3C
+busses in a device tree.
+
+Required properties
+-------------------
+
+- #address-cells  - should be <3>. Read more about addresses below.
+- #size-cells     - should be <0>.
+- compatible      - name of the I3C master controller driving the I3C bus
+
+For other required properties e.g. to describe register sets,
+clocks, etc. check the binding documentation of the specific driver.
+The node describing an I3C bus should be named i3c-master.
+
+Optional properties
+-------------------
+
+These properties may not be supported by all I3C master drivers. Each I3C
+master bindings should specify which of them are supported.
+
+- i3c-scl-hz: frequency of the SCL signal used for I3C transfers.
+	      When undefined the core sets it to 12.5MHz.
+
+- i2c-scl-hz: frequency of the SCL signal used for I2C transfers.
+	      When undefined, the core looks at LVR (Legacy Virtual Register)
+	      values of I2C devices described in the device tree to determine
+	      the maximum I2C frequency.
+
+I2C devices
+===========
+
+Each I2C device connected to the bus should be described in a subnode. All
+properties described in Documentation/devicetree/bindings/i2c/i2c.txt are
+valid here, but several new properties have been added.
+
+New constraint on existing properties:
+--------------------------------------
+- reg: contains 3 cells
+  + first cell : still encoding the I2C address
+
+  + second cell: should have bit 31 set to 1 signify that this is an I2C
+		 device. Bits 0 to 7 encode the I3C LVR (Legacy Virtual
+		 Register):
+
+	bit[7:5]: I2C device index. Possible values
+	* 0: I2C device has a 50 ns spike filter
+	* 1: I2C device does not have a 50 ns spike filter but supports high
+	     frequency on SCL
+	* 2: I2C device does not have a 50 ns spike filter and is not tolerant
+	     to high frequencies
+	* 3-7: reserved
+
+	bit[4]: tell whether the device operates in FM (Fast Mode) or FM+ mode
+	* 0: FM+ mode
+	* 1: FM mode
+
+	bit[3:0]: device type
+	* 0-15: reserved
+
+  + third cell: should be 0
+
+I3C devices
+===========
+
+All I3C devices are supposed to support DAA (Dynamic Address Assignment), and
+are thus discoverable. So, by default, I3C devices do not have to be described
+in the device tree.
+This being said, one might want to attach extra resources to these devices,
+and those resources may have to be described in the device tree, which in turn
+means we have to describe I3C devices.
+
+Another use case for describing an I3C device in the device tree is when this
+I3C device has a static address and we want to assign it a specific dynamic
+address before the DAA takes place (so that other devices on the bus can't
+take this dynamic address).
+
+The I3C device should be names <device-type>@<static-address>,<i3c-pid>,
+where device-type is describing the type of device connected on the bus
+(gpio-controller, sensor, ...).
+
+Required properties
+-------------------
+- reg: contains 3 cells
+  + first cell : encodes the I2C address. Should be 0 if the device does not
+		 have one (0 is not a valid I3C address).
+
+  + second and third cells: should encode the ProvisionalID. The second cell
+			    contains the manufacturer ID left-shifted by 1.
+			    The third cell contains ORing of the part ID
+			    left-shifted by 16, the instance ID left-shifted
+			    by 12 and the extra information. This encoding is
+			    following the PID definition provided by the I3C
+			    specification.
+
+Optional properties
+-------------------
+- assigned-address: dynamic address to be assigned to this device. This
+		    property is only valid if the I3C device has a static
+		    address (first cell of the reg property != 0).
+
+
+Example:
+
+	i3c-master@d040000 {
+		compatible = "cdns,i3c-master";
+		clocks = <&coreclock>, <&i3csysclock>;
+		clock-names = "pclk", "sysclk";
+		interrupts = <3 0>;
+		reg = <0x0d040000 0x1000>;
+		#address-cells = <3>;
+		#size-cells = <0>;
+
+		status = "okay";
+		i2c-scl-frequency = <100000>;
+
+		/* I2C device. */
+		nunchuk: nunchuk@52 {
+			compatible = "nintendo,nunchuk";
+			reg = <0x52 0x80000010 0x0>;
+		};
+
+		/* I3C device with a static address. */
+		thermal_sensor: sensor@68,39200144004 {
+			reg = <0x68 0x392 0x144004>;
+			assigned-address = <0xa>;
+		};
+
+		/*
+		 * I3C device without a static address but requiring resources
+		 * described in the DT.
+		 */
+		sensor@0,39200154004 {
+			reg = <0x0 0x392 0x154004>;
+			clocks = <&clock_provider 0>;
+		};
+	};
+
Signature · 1 line
2.14.1
#18 lore raw

PATCH v3 6/11 dt-bindings: i3c: Add macros to help fill I3C/I2C device's reg property

In reply to Boris Brezillon

The reg property of devices connected to an I3C bus have 3 cells, and filling them manually is not trivial. Provides macros to help doing that.

---
 include/dt-bindings/i3c/i3c.h | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 include/dt-bindings/i3c/i3c.h
include/dt-bindings/i3c/i3c.h new file +28 -0
new file mode 100644
index 000000000000..97448c546649
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2017 Cadence Design Systems Inc.
+ *
+ * Author: Boris Brezillon <[email protected]>
+ */
+
+#ifndef _DT_BINDINGS_I3C_I3C_H
+#define _DT_BINDINGS_I3C_I3C_H
+
+#define IS_I2C_DEV		0x80000000
+
+#define I2C_DEV(addr, lvr)					\
+	(addr) (IS_I2C_DEV | (lvr)) 0x0
+
+#define I3C_PID(manufid, partid, instid, extrainfo)		\
+	((manufid) << 1)					\
+	(((partid) << 16) | ((instid) << 12) | (extrainfo))
+
+#define I3C_DEV_WITH_STATIC_ADDR(addr, manufid, partid,		\
+				 instid, extrainfo)		\
+	(addr) I3C_PID(manufid, partid, instid, extrainfo)
+
+#define I3C_DEV(manufid, partid, instid, extrainfo)		\
+	I3C_DEV_WITH_STATIC_ADDR(0x0, manufid, partid,		\
+				 instid, extrainfo)
+
+#endif
Signature · 1 line
2.14.1
#20 lore raw

PATCH v3 7/11 MAINTAINERS: Add myself as the I3C subsystem maintainer

In reply to Boris Brezillon

Create an entry for the I3C subsystem and mark it as maintained by me. There's no official git repository, patchwork instance, mailing list or website yet, but this will be added after the subsystem has been accepted.

---
 MAINTAINERS | 9 +++++++++
 1 file changed, 9 insertions(+)
MAINTAINERS +9 -0
index 3bdc260e36b7..f323864131ed 100644
@@ -6669,6 +6669,15 @@ L:	[email protected]
 S:	Maintained
 F:	drivers/i2c/i2c-stub.c
 
+I3C SUBSYSTEM
+M:	Boris Brezillon <[email protected]>
+S:	Maintained
+F:	Documentation/devicetree/bindings/i3c/
+F:	Documentation/driver-api/i3c
+F:	drivers/i3c/
+F:	include/linux/i3c/
+F:	include/dt-bindings/i3c/
+
 IA64 (Itanium) PLATFORM
 M:	Tony Luck <[email protected]>
 M:	Fenghua Yu <[email protected]>
Signature · 1 line
2.14.1
#21 lore raw

PATCH v3 8/11 i3c: master: Add driver for Cadence IP

In reply to Boris Brezillon

From: Boris Brezillon <[email protected]>

Add a driver for Cadence I3C master IP.

---
Changes in v3:
- Adjust to match I3C framework changes
- Implement support the CMD RESPONSE QUEUE and IBI QUEUE added in the latest revision of Cadence master IP
- Remove support for HDR modes

Changes in v2:
- Add basic IBI support. Note that the IP is not really reliable with regards to IBI because you can't extract IBI payloads as soon as you have more than one IBI waiting in the HW queue. This is something that will hopefully be addressed in future revisions of this IP
- Add a simple xfer queueing mechanism to optimize message queuing.
- Fix a few bugs
- Add support for Hot Join

---
 drivers/i3c/master/Kconfig           |    5 +
 drivers/i3c/master/Makefile          |    1 +
 drivers/i3c/master/i3c-master-cdns.c | 1648 ++++++++++++++++++++++++++++++++++
 3 files changed, 1654 insertions(+)
 create mode 100644 drivers/i3c/master/i3c-master-cdns.c
drivers/i3c/master/Kconfig +5 -0
index e69de29bb2d1..56b9a18543b2 100644
@@ -0,0 +1,5 @@
+config CDNS_I3C_MASTER
+	tristate "Cadence I3C master driver"
+	depends on I3C
+	help
+	  Enable this driver if you want to support Cadence I3C master block.
drivers/i3c/master/Makefile +1 -0
index e69de29bb2d1..4c4304aa9534 100644
@@ -0,0 +1 @@
+obj-$(CONFIG_CDNS_I3C_MASTER)		+= i3c-master-cdns.o
drivers/i3c/master/i3c-master-cdns.c new file +1648 -0

1,648 lines not on this page · raw message

Signature · 1 line
2.14.1
#22 lore raw

PATCH v3 9/11 dt-bindings: i3c: Document Cadence I3C master bindings

In reply to Boris Brezillon

From: Boris Brezillon <[email protected]>

Document Cadence I3C master DT bindings.

---
 .../devicetree/bindings/i3c/cdns,i3c-master.txt    | 45 ++++++++++++++++++++++
 1 file changed, 45 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/i3c/cdns,i3c-master.txt
Documentation/devicetree/bindings/i3c/cdns,i3c-master.txt new file +45 -0
new file mode 100644
index 000000000000..f9e4af4ff1c7
@@ -0,0 +1,45 @@
+Bindings for cadence I3C master block
+=====================================
+
+Required properties:
+--------------------
+- compatible: shall be "cdns,i3c-master"
+- clocks: shall reference the pclk and sysclk
+- clock-names: shall contain "pclk" and "sysclk"
+- interrupts: the interrupt line connected to this I3C master
+- reg: I3C master registers
+
+Mandatory properties defined by the generic binding (see
+Documentation/devicetree/bindings/i3c/i3c.txt for more details):
+
+- #address-cells: shall be set to 1
+- #size-cells: shall be set to 0
+
+Optional properties defined by the generic binding (see
+Documentation/devicetree/bindings/i3c/i3c.txt for more details):
+
+- i2c-scl-frequency
+- i3c-scl-frequency
+
+I3C device connected on the bus follow the generic description (see
+Documentation/devicetree/bindings/i3c/i3c.txt for more details).
+
+Example:
+
+	i3c-master@0d040000 {
+		compatible = "cdns,i3c-master";
+		clocks = <&coreclock>, <&i3csysclock>;
+		clock-names = "pclk", "sysclk";
+		interrupts = <3 0>;
+		reg = <0x0d040000 0x1000>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+		i2c-scl-frequency = <100000>;
+
+		nunchuk: nunchuk@52 {
+			compatible = "nintendo,nunchuk";
+			reg = <0x52>;
+			i3c-lvr = <0x10>;
+		};
+	};
+
Signature · 1 line
2.14.1
#25 lore raw

PATCH v3 10/11 gpio: Add a driver for Cadence I3C GPIO expander

In reply to Boris Brezillon

Add a driver for Cadence I3C GPIO expander.

---
 drivers/gpio/Kconfig         |  11 ++
 drivers/gpio/Makefile        |   1 +
 drivers/gpio/gpio-cdns-i3c.c | 380 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 392 insertions(+)
 create mode 100644 drivers/gpio/gpio-cdns-i3c.c
drivers/gpio/Kconfig +11 -0
index 8dbb2280538d..87b7083179ff 100644
@@ -862,6 +862,17 @@ config GPIO_TS4900
 
 endmenu
 
+menu "I3C GPIO expanders"
+	depends on I3C
+
+config GPIO_CDNS_I3C
+	tristate "Cadence I3C GPIO expander"
+	select GPIOLIB_IRQCHIP
+	help
+	  Say yes here to enabled the driver for Cadence I3C GPIO expander.
+
+endmenu
+
 menu "MFD GPIO expanders"
 
 config GPIO_ADP5520
drivers/gpio/Makefile +1 -0
index cccb0d40846c..22a7151fc565 100644
@@ -36,6 +36,7 @@ obj-$(CONFIG_GPIO_BCM_KONA)	+= gpio-bcm-kona.o
 obj-$(CONFIG_GPIO_BD9571MWV)	+= gpio-bd9571mwv.o
 obj-$(CONFIG_GPIO_BRCMSTB)	+= gpio-brcmstb.o
 obj-$(CONFIG_GPIO_BT8XX)	+= gpio-bt8xx.o
+obj-$(CONFIG_GPIO_CDNS_I3C)	+= gpio-cdns-i3c.o
 obj-$(CONFIG_GPIO_CLPS711X)	+= gpio-clps711x.o
 obj-$(CONFIG_GPIO_CS5535)	+= gpio-cs5535.o
 obj-$(CONFIG_GPIO_CRYSTAL_COVE)	+= gpio-crystalcove.o
drivers/gpio/gpio-cdns-i3c.c new file +380 -0

380 lines not on this page · raw message

Signature · 1 line
2.14.1
#26 lore raw

PATCH v3 11/11 dt-bindings: gpio: Add bindings for Cadence I3C gpio expander

In reply to Boris Brezillon

Document the Cadence I3C gpio expander bindings.

---
 .../devicetree/bindings/gpio/gpio-cdns-i3c.txt     | 38 ++++++++++++++++++++++
 1 file changed, 38 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpio/gpio-cdns-i3c.txt
Documentation/devicetree/bindings/gpio/gpio-cdns-i3c.txt new file +38 -0
new file mode 100644
index 000000000000..634b1f268215
@@ -0,0 +1,38 @@
+* Cadence I3C GPIO expander
+
+The Cadence I3C GPIO expander provides 8 GPIOs controllable over I3C.
+This GPIOs can be configured in output or input mode and if they are in input
+mode they can generate IBIs (In Band Interrupts).
+
+Required properties for GPIO node:
+- reg : 3 cells encoding the I3C static address (none in our case) and the I3C
+	Provisional ID. See Documentation/devicetree/bindings/i3c/i3c.txt for
+	more details.
+	Should be <0x0 0x392 0x0>.
+- gpio-controller : Marks the device node as a gpio controller.
+- #gpio-cells : Should be two. The first cell is the pin number and
+  the second cell is used to specify the gpio polarity:
+      0 = active high
+      1 = active low
+- interrupt-controller: Marks the device node as an interrupt controller.
+- #interrupt-cells : Should be 2.  The first cell is the GPIO number.
+  The second cell bits[3:0] is used to specify trigger type and level flags:
+      1 = low-to-high edge triggered.
+      2 = high-to-low edge triggered.
+      3 = triggered on both edges.
+      4 = active high level-sensitive.
+      8 = active low level-sensitive.
+
+Example:
+
+	i3c-master@xxx {
+		...
+		i3c_gpio_expander: gpio@0,1c9,0 {
+			reg = <0 0x392 0x0>;
+			gpio-controller;
+			#gpio-cells = <2>;
+			interrupt-controller;
+			#interrupt-cells = <2>;
+		};
+		...
+	};
Signature · 1 line
2.14.1
#33 lore raw
In reply to Boris Brezillon
Quoted 68 lines · On Fri, 23 Mar 2018 12:00:09 +0100 Boris Brezillon…

This patch series is a proposal for a new I3C [1] subsystem.

This infrastructure is not complete yet and will be extended over time.

There are a few design choices that are worth mentioning because they impact the way I3C device drivers can interact with their devices:

- all functions used to send I3C/I2C frames must be called in non-atomic context. Mainly done this way to ease implementation, but this is still open to discussion. Please let me know if you think it's worth considering an asynchronous model here
- the bus element is a separate object and is not implicitly described by the master (as done in I2C). The reason is that I want to be able to handle multiple master connected to the same bus and visible to Linux.
In this situation, we should only have one instance of the device and not one per master, and sharing the bus object would be part of the solution to gracefully handle this case.
I'm not sure if we will ever need to deal with multiple masters controlling the same bus and exposed under Linux, but separating the bus and master concept is pretty easy, hence the decision to do it now, just in case we need it some day.
The other benefit of separating the bus and master concepts is that master devices appear under the bus directory in sysfs.
- I2C backward compatibility has been designed to be transparent to I2C drivers and the I2C subsystem. The I3C master just registers an I2C adapter which creates a new I2C bus. I'd say that, from a representation PoV it's not ideal because what should appear as a single I3C bus exposing I3C and I2C devices here appears as 2 different busses connected to each other through the parenting (the I3C master is the parent of the I2C and I3C busses).
On the other hand, I don't see a better solution if we want something that is not invasive.

Missing features in this preliminary version:
- support for HDR modes (has been removed because of lack of real users)
- no support for multi-master and the associated concepts (mastership handover, support for secondary masters, ...)
- I2C devices can only be described using DT because this is the only use case I have. However, the framework can easily be extended with ACPI and board info support
- I3C slave framework. This has been completely omitted, but shouldn't have a huge impact on the I3C framework because I3C slaves don't see the whole bus, it's only about handling master requests and generating IBIs. Some of the struct, constant and enum definitions could be shared, but most of the I3C slave framework logic will be different

Main changes between v2 and v3 are:
- Reworked the DT bindings as suggested by Rob
- Reworked the bus initialization step as suggested by Vitor
- Added a driver for an I3C GPIO expander

Main changes between the initial RFC and this v2 are:
- Add a generic infrastructure to support IBIs. It's worth mentioning that I tried exposing IBIs as a regular IRQs, but after several attempts and a discussion with Mark Zyngier, it appeared that it was not really fitting in the Linux IRQ model (the fact that you have payload attached to IBIs, the fact that most of the time an IBI will generate a transfer on the bus which has to be done in an atomic context, ...)
The counterpart of this decision is the latency induced by the workqueue approach, but since I don't have real use cases, I don't know if this can be a problem or not.
- Add helpers to support Hot Join
- Add support for IBIs and Hot Join in Cadence I3C master driver
- Address several issues in how I was using the device model

Quoted 3 lines

I'll finish on a good news: this week the MIPI alliance opened the I3C spec. So everyone can now review the patches (no need to be member of the MIPI I3C group).

Okay, okay, the news is a bit out-dated, but this is still good news :-). I'll try to remove this part in the next iteration.

Quoted 79 lines

I'll let you find the link in the doc, this way maybe I'll have reviews on the doc itself :-).

Thanks,

Boris

Boris Brezillon (11):
i2c: Export of_i2c_get_board_info()
i3c: Add core I3C infrastructure
docs: driver-api: Add I3C documentation
i3c: Add sysfs ABI spec
dt-bindings: i3c: Document core bindings
dt-bindings: i3c: Add macros to help fill I3C/I2C device's reg
property
MAINTAINERS: Add myself as the I3C subsystem maintainer
i3c: master: Add driver for Cadence IP
dt-bindings: i3c: Document Cadence I3C master bindings
gpio: Add a driver for Cadence I3C GPIO expander
dt-bindings: gpio: Add bindings for Cadence I3C gpio expander

 Documentation/ABI/testing/sysfs-bus-i3c            |   95 ++
 .../devicetree/bindings/gpio/gpio-cdns-i3c.txt     |   38 +
 .../devicetree/bindings/i3c/cdns,i3c-master.txt    |   45 +
 Documentation/devicetree/bindings/i3c/i3c.txt      |  140 ++
 Documentation/driver-api/i3c/conf.py               |   10 +
 Documentation/driver-api/i3c/device-driver-api.rst |    7 +
 Documentation/driver-api/i3c/index.rst             |    9 +
 Documentation/driver-api/i3c/master-driver-api.rst |    8 +
 Documentation/driver-api/i3c/protocol.rst          |  201 +++
 Documentation/driver-api/index.rst                 |    1 +
 MAINTAINERS                                        |    9 +
 drivers/Kconfig                                    |    2 +
 drivers/Makefile                                   |    2 +-
 drivers/gpio/Kconfig                               |   11 +
 drivers/gpio/Makefile                              |    1 +
 drivers/gpio/gpio-cdns-i3c.c                       |  380 +++++
 drivers/i2c/i2c-core-base.c                        |    2 +-
 drivers/i2c/i2c-core-of.c                          |   66 +-
 drivers/i3c/Kconfig                                |   24 +
 drivers/i3c/Makefile                               |    4 +
 drivers/i3c/core.c                                 |  620 +++++++
 drivers/i3c/device.c                               |  294 ++++
 drivers/i3c/internals.h                            |   28 +
 drivers/i3c/master.c                               | 1723 ++++++++++++++++++++
 drivers/i3c/master/Kconfig                         |    5 +
 drivers/i3c/master/Makefile                        |    1 +
 drivers/i3c/master/i3c-master-cdns.c               | 1648 +++++++++++++++++++
 include/dt-bindings/i3c/i3c.h                      |   28 +
 include/linux/i2c.h                                |   10 +
 include/linux/i3c/ccc.h                            |  382 +++++
 include/linux/i3c/device.h                         |  305 ++++
 include/linux/i3c/master.h                         |  587 +++++++
 include/linux/mod_devicetable.h                    |   17 +
 33 files changed, 6673 insertions(+), 30 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-i3c
 create mode 100644 Documentation/devicetree/bindings/gpio/gpio-cdns-i3c.txt
 create mode 100644 Documentation/devicetree/bindings/i3c/cdns,i3c-master.txt
 create mode 100644 Documentation/devicetree/bindings/i3c/i3c.txt
 create mode 100644 Documentation/driver-api/i3c/conf.py
 create mode 100644 Documentation/driver-api/i3c/device-driver-api.rst
 create mode 100644 Documentation/driver-api/i3c/index.rst
 create mode 100644 Documentation/driver-api/i3c/master-driver-api.rst
 create mode 100644 Documentation/driver-api/i3c/protocol.rst
 create mode 100644 drivers/gpio/gpio-cdns-i3c.c
 create mode 100644 drivers/i3c/Kconfig
 create mode 100644 drivers/i3c/Makefile
 create mode 100644 drivers/i3c/core.c
 create mode 100644 drivers/i3c/device.c
 create mode 100644 drivers/i3c/internals.h
 create mode 100644 drivers/i3c/master.c
 create mode 100644 drivers/i3c/master/Kconfig
 create mode 100644 drivers/i3c/master/Makefile
 create mode 100644 drivers/i3c/master/i3c-master-cdns.c
 create mode 100644 include/dt-bindings/i3c/i3c.h
 create mode 100644 include/linux/i3c/ccc.h
 create mode 100644 include/linux/i3c/device.h
 create mode 100644 include/linux/i3c/master.h
Signature · 3 lines
Boris Brezillon, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
#23 lore raw

Re: [PATCH v3 09/11] dt-bindings: i3c: Document Cadence I3C master bindings

In reply to Boris Brezillon

Hello,

Documentation/devicetree/bindings/i3c/cdns,i3c-master.txt line 22

Quoted 5 lines · Boris Brezillon
Documentation/devicetree/bindings/i3c/cdns,i3c-master.txt new file +5 -0
+Optional properties defined by the generic binding (see
+Documentation/devicetree/bindings/i3c/i3c.txt for more details):
+
+- i2c-scl-frequency
+- i3c-scl-frequency

These properties are now named *-scl-hz.

Documentation/devicetree/bindings/i3c/cdns,i3c-master.txt line 37

Quoted 11 lines
Documentation/devicetree/bindings/i3c/cdns,i3c-master.txt new file +11 -0
+Example:
+
+	i3c-master@0d040000 {
+		compatible = "cdns,i3c-master";
+		clocks = <&coreclock>, <&i3csysclock>;
+		clock-names = "pclk", "sysclk";
+		interrupts = <3 0>;
+		reg = <0x0d040000 0x1000>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+		i2c-scl-frequency = <100000>;

Ditto.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
#10 lore raw

Re: [PATCH v3 05/11] dt-bindings: i3c: Document core bindings

In reply to Boris Brezillon
Quoted 137 lines · Boris Brezillon

From: Boris Brezillon <[email protected]>

A new I3C subsystem has been added and a generic description has been created to represent the I3C bus and the devices connected on it.

Document this generic representation.

---
Changes in v3:
- Rename {i2c,i3c}-scl-frequency DT prop into {i2c,i3c}-scl-hz
- Rework the way we expose the provisional ID and LVR information
- Rename dynamic-address into assigned-address
- Enforce the I3C master node name

Changes in v2:
- Define how to describe I3C devices in the DT and when it should be used. Note that the parsing of I3C devices is not yet implemented in the framework. Will be added when someone really needs it.

---
 Documentation/devicetree/bindings/i3c/i3c.txt | 140 ++++++++++++++++++++++++++
 1 file changed, 140 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/i3c/i3c.txt
Documentation/devicetree/bindings/i3c/i3c.txt new file +107 -0
new file mode 100644
index 000000000000..ed858228d26b
@@ -0,0 +1,140 @@
+Generic device tree bindings for I3C busses
+===========================================
+
+This document describes generic bindings that should be used to describe I3C
+busses in a device tree.
+
+Required properties
+-------------------
+
+- #address-cells  - should be <3>. Read more about addresses below.
+- #size-cells     - should be <0>.
+- compatible      - name of the I3C master controller driving the I3C bus
+
+For other required properties e.g. to describe register sets,
+clocks, etc. check the binding documentation of the specific driver.
+The node describing an I3C bus should be named i3c-master.
+
+Optional properties
+-------------------
+
+These properties may not be supported by all I3C master drivers. Each I3C
+master bindings should specify which of them are supported.
+
+- i3c-scl-hz: frequency of the SCL signal used for I3C transfers.
+	      When undefined the core sets it to 12.5MHz.
+
+- i2c-scl-hz: frequency of the SCL signal used for I2C transfers.
+	      When undefined, the core looks at LVR (Legacy Virtual Register)
+	      values of I2C devices described in the device tree to determine
+	      the maximum I2C frequency.
+
+I2C devices
+===========
+
+Each I2C device connected to the bus should be described in a subnode. All
+properties described in Documentation/devicetree/bindings/i2c/i2c.txt are
+valid here, but several new properties have been added.
+
+New constraint on existing properties:
+--------------------------------------
+- reg: contains 3 cells
+  + first cell : still encoding the I2C address
+
+  + second cell: should have bit 31 set to 1 signify that this is an I2C
+		 device. Bits 0 to 7 encode the I3C LVR (Legacy Virtual
+		 Register):
+
+	bit[7:5]: I2C device index. Possible values
+	* 0: I2C device has a 50 ns spike filter
+	* 1: I2C device does not have a 50 ns spike filter but supports high
+	     frequency on SCL
+	* 2: I2C device does not have a 50 ns spike filter and is not tolerant
+	     to high frequencies
+	* 3-7: reserved
+
+	bit[4]: tell whether the device operates in FM (Fast Mode) or FM+ mode
+	* 0: FM+ mode
+	* 1: FM mode
+
+	bit[3:0]: device type
+	* 0-15: reserved
+
+  + third cell: should be 0
+
+I3C devices
+===========
+
+All I3C devices are supposed to support DAA (Dynamic Address Assignment), and
+are thus discoverable. So, by default, I3C devices do not have to be described
+in the device tree.
+This being said, one might want to attach extra resources to these devices,
+and those resources may have to be described in the device tree, which in turn
+means we have to describe I3C devices.
+
+Another use case for describing an I3C device in the device tree is when this
+I3C device has a static address and we want to assign it a specific dynamic
+address before the DAA takes place (so that other devices on the bus can't
+take this dynamic address).
+
+The I3C device should be names <device-type>@<static-address>,<i3c-pid>,
+where device-type is describing the type of device connected on the bus
+(gpio-controller, sensor, ...).
+
+Required properties
+-------------------
+- reg: contains 3 cells
+  + first cell : encodes the I2C address. Should be 0 if the device does not
+		 have one (0 is not a valid I3C address).
+
+  + second and third cells: should encode the ProvisionalID. The second cell
+			    contains the manufacturer ID left-shifted by 1.
+			    The third cell contains ORing of the part ID
+			    left-shifted by 16, the instance ID left-shifted
+			    by 12 and the extra information. This encoding is
+			    following the PID definition provided by the I3C
+			    specification.
+
+Optional properties
+-------------------
+- assigned-address: dynamic address to be assigned to this device. This
+		    property is only valid if the I3C device has a static
+		    address (first cell of the reg property != 0).
+
+
+Example:
+
+	i3c-master@d040000 {

Documentation/devicetree/bindings/i3c/i3c.txt line 117

Quoted 10 lines
Documentation/devicetree/bindings/i3c/i3c.txt new file +10 -0
+		compatible = "cdns,i3c-master";
+		clocks = <&coreclock>, <&i3csysclock>;
+		clock-names = "pclk", "sysclk";
+		interrupts = <3 0>;
+		reg = <0x0d040000 0x1000>;
+		#address-cells = <3>;
+		#size-cells = <0>;
+
+		status = "okay";
+		i2c-scl-frequency = <100000>;

Another s/frequency/hz/ instance, similar to those reported by Thomas.

Cheers,
Peter

Quoted 24 lines
Documentation/devicetree/bindings/i3c/i3c.txt new file +23 -0
+
+		/* I2C device. */
+		nunchuk: nunchuk@52 {
+			compatible = "nintendo,nunchuk";
+			reg = <0x52 0x80000010 0x0>;
+		};
+
+		/* I3C device with a static address. */
+		thermal_sensor: sensor@68,39200144004 {
+			reg = <0x68 0x392 0x144004>;
+			assigned-address = <0xa>;
+		};
+
+		/*
+		 * I3C device without a static address but requiring resources
+		 * described in the DT.
+		 */
+		sensor@0,39200154004 {
+			reg = <0x0 0x392 0x154004>;
+			clocks = <&clock_provider 0>;
+		};
+	};
+
#11 lore raw

Re: [PATCH v3 05/11] dt-bindings: i3c: Document core bindings

Quoted 7 lines · On Fri, 23 Mar 2018 13:47:49 +0100 Peter Rosin <[email protected]> wrote:
Quoted 7 lines
Documentation/devicetree/bindings/i3c/i3c.txt new file +7 -0
+Example:
+
+	i3c-master@d040000 {
+		compatible = "cdns,i3c-master";
+		clocks = <&coreclock>, <&i3csysclock>;
+		clock-names = "pclk", "sysclk";
+		interrupts = <3 0>;
Quoted 8 lines

Documentation/devicetree/bindings/i3c/i3c.txt line 117

Quoted 6 lines
Documentation/devicetree/bindings/i3c/i3c.txt new file +6 -0
+		reg = <0x0d040000 0x1000>;
+		#address-cells = <3>;
+		#size-cells = <0>;
+
+		status = "okay";
+		i2c-scl-frequency = <100000>;  

Another s/frequency/hz/ instance, similar to those reported by Thomas.

Will fix it in v4.

Thanks,

Boris

Signature · 3 lines
Boris Brezillon, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
#24 lore raw

Re: [PATCH v3 09/11] dt-bindings: i3c: Document Cadence I3C master bindings

In reply to Thomas Petazzoni
Quoted 12 lines · On Fri, 23 Mar 2018 12:10:35 +0100 Thomas Petazzoni…

Hello,

Documentation/devicetree/bindings/i3c/cdns,i3c-master.txt line 22

Quoted 5 lines · Boris Brezillon
Documentation/devicetree/bindings/i3c/cdns,i3c-master.txt new file +5 -0
+Optional properties defined by the generic binding (see
+Documentation/devicetree/bindings/i3c/i3c.txt for more details):
+
+- i2c-scl-frequency
+- i3c-scl-frequency  

These properties are now named *-scl-hz.

Quoted 13 lines

Documentation/devicetree/bindings/i3c/cdns,i3c-master.txt line 37

Quoted 11 lines
Documentation/devicetree/bindings/i3c/cdns,i3c-master.txt new file +11 -0
+Example:
+
+	i3c-master@0d040000 {
+		compatible = "cdns,i3c-master";
+		clocks = <&coreclock>, <&i3csysclock>;
+		clock-names = "pclk", "sysclk";
+		interrupts = <3 0>;
+		reg = <0x0d040000 0x1000>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+		i2c-scl-frequency = <100000>;  

Ditto.

I'll fix that in v4.

Thanks for the review.

Boris

Signature · 3 lines
Boris Brezillon, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
#2 lore raw

Re: [PATCH v3 01/11] i2c: Export of_i2c_get_board_info()

In reply to Boris Brezillon

Hi Boris,

Quoted 1 line

- rebase on v4.15-rc1

This code has changed a little meanwhile. Please check my for-next branch. Some changes are identical, some similar.

drivers/i2c/i2c-core-of.c line 68

Quoted 1 line
drivers/i2c/i2c-core-of.c +0 -1
-	info.archdata = &dev_ad;

Why did you drop this?

Regards,

Wolfram

#3 lore raw

Re: [PATCH v3 01/11] i2c: Export of_i2c_get_board_info()

Quoted 4 lines

drivers/i2c/i2c-core-of.c line 68

Quoted 2 lines
drivers/i2c/i2c-core-of.c +0 -1
-	info.archdata = &dev_ad;

Why did you drop this?

If the removal is safe, it should be a seperate patch, I mean.

#5 lore raw

Re: [PATCH v3 01/11] i2c: Export of_i2c_get_board_info()

In reply to Wolfram Sang

Hi Wolfram,

Quoted 6 lines · On Sat, 24 Mar 2018 23:35:18 +0100 Wolfram Sang <[email protected]> wrote:

Hi Boris,

Quoted 1 line

- rebase on v4.15-rc1

This code has changed a little meanwhile. Please check my for-next branch. Some changes are identical, some similar.

Actually it was rebased on top of v4.16-rc1, but I'll check if this patch applies correctly on top of your for-next branch.

Quoted 4 lines

drivers/i2c/i2c-core-of.c line 68

Quoted 2 lines
drivers/i2c/i2c-core-of.c +0 -1
-	info.archdata = &dev_ad;  

Why did you drop this?

Well, this line could have been moved in of_i2c_register_device(), but I realized dev_ad was zero initialized without any further modification, and leaving info->archdata to NULL has the exact same effect (see [1]).

Regards,

Boris

[1]https://elixir.bootlin.com/linux/v4.16-rc6/source/drivers/i2c/i2c-core-base.c#L711

Signature · 3 lines
Boris Brezillon, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
#4 lore raw

Re: [PATCH v3 01/11] i2c: Export of_i2c_get_board_info()

In reply to Wolfram Sang
Quoted 6 lines · On Sat, 24 Mar 2018 23:38:32 +0100 Wolfram Sang <[email protected]> wrote:
Quoted 3 lines

drivers/i2c/i2c-core-of.c line 68

Quoted 1 line
drivers/i2c/i2c-core-of.c +0 -1
-	info.archdata = &dev_ad;  

Why did you drop this?

If the removal is safe, it should be a seperate patch, I mean.

Sure, I'll move that in a separate patch. Actually, I had a closer look and it seems the only user of info->archdata is i2c-core-of.c, so we can even remove the info->archdata field.

Signature · 3 lines
Boris Brezillon, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
#27 lore raw

Re: [PATCH v3 11/11] dt-bindings: gpio: Add bindings for Cadence I3C gpio expander

In reply to Boris Brezillon

Hi Boris,

Quoted 3 lines · Boris Brezillon

Document the Cadence I3C gpio expander bindings.

Thanks for your patch!

Documentation/devicetree/bindings/gpio/gpio-cdns-i3c.txt line 24

Quoted 10 lines
Documentation/devicetree/bindings/gpio/gpio-cdns-i3c.txt new file +7 -0
 
+- #interrupt-cells : Should be 2.  The first cell is the GPIO number.
+  The second cell bits[3:0] is used to specify trigger type and level flags:
+      1 = low-to-high edge triggered.
+      2 = high-to-low edge triggered.
+      3 = triggered on both edges.
+      4 = active high level-sensitive.
+      8 = active low level-sensitive.

These are identical to the values in <dt-bindings/interrupt-controller/irq.h>. Perhaps you can refer to those definitions?
I don't think we want to see the hardcoded numbers in DTS files.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#30 lore raw

Re: [PATCH v3 11/11] dt-bindings: gpio: Add bindings for Cadence I3C gpio expander

In reply to Boris Brezillon

Hi Boris,

Quoted 3 lines · Boris Brezillon

Document the Cadence I3C gpio expander bindings.

Thanks for your patch!

Quoted 4 lines
Documentation/devicetree/bindings/gpio/gpio-cdns-i3c.txt new file +1 -0
@@ -0,0 +1,38 @@
+* Cadence I3C GPIO expander

Documentation/devicetree/bindings/gpio/gpio-cdns-i3c.txt line 11

Quoted 10 lines
Documentation/devicetree/bindings/gpio/gpio-cdns-i3c.txt new file +10 -0
+
+The Cadence I3C GPIO expander provides 8 GPIOs controllable over I3C.
+This GPIOs can be configured in output or input mode and if they are in input
+mode they can generate IBIs (In Band Interrupts).
+
+Required properties for GPIO node:
+- reg : 3 cells encoding the I3C static address (none in our case) and the I3C
+       Provisional ID. See Documentation/devicetree/bindings/i3c/i3c.txt for
+       more details.
+       Should be <0x0 0x392 0x0>.

No compatible value?

Quoted 9 lines
Documentation/devicetree/bindings/gpio/gpio-cdns-i3c.txt new file +9 -0
+- gpio-controller : Marks the device node as a gpio controller.
+- #gpio-cells : Should be two. The first cell is the pin number and
+  the second cell is used to specify the gpio polarity:
+      0 = active high
+      1 = active low
+- interrupt-controller: Marks the device node as an interrupt controller.
+- #interrupt-cells : Should be 2.  The first cell is the GPIO number.
+  The second cell bits[3:0] is used to specify trigger type and level flags:
+      1 = low-to-high edge triggered.

Documentation/devicetree/bindings/gpio/gpio-cdns-i3c.txt line 30

Quoted 10 lines
Documentation/devicetree/bindings/gpio/gpio-cdns-i3c.txt new file +10 -0
+      2 = high-to-low edge triggered.
+      3 = triggered on both edges.
+      4 = active high level-sensitive.
+      8 = active low level-sensitive.
+
+Example:
+
+       i3c-master@xxx {
+               ...
+               i3c_gpio_expander: gpio@0,1c9,0 {

gpio@0,392,0?

Documentation/devicetree/bindings/gpio/gpio-cdns-i3c.txt line 38

Quoted 8 lines
Documentation/devicetree/bindings/gpio/gpio-cdns-i3c.txt new file +8 -0
+                       reg = <0 0x392 0x0>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+               };
+               ...
+       };

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#12 lore raw

Re: [PATCH v3 05/11] dt-bindings: i3c: Document core bindings

In reply to Boris Brezillon

Hi Boris,

Quoted 8 lines · Boris Brezillon

From: Boris Brezillon <[email protected]>

A new I3C subsystem has been added and a generic description has been created to represent the I3C bus and the devices connected on it.

Document this generic representation.

Thanks for your patch!

Documentation/devicetree/bindings/i3c/i3c.txt line 70

Quoted 10 lines
Documentation/devicetree/bindings/i3c/i3c.txt new file +6 -0
@@ -0,0 +1,140 @@
 
+I3C devices
+===========
+
+All I3C devices are supposed to support DAA (Dynamic Address Assignment), and
+are thus discoverable. So, by default, I3C devices do not have to be described
+in the device tree.

But if they're described, they should have a compatible value, no?

Documentation/devicetree/bindings/i3c/i3c.txt line 80

Quoted 10 lines
Documentation/devicetree/bindings/i3c/i3c.txt new file +10 -0
+This being said, one might want to attach extra resources to these devices,
+and those resources may have to be described in the device tree, which in turn
+means we have to describe I3C devices.
+
+Another use case for describing an I3C device in the device tree is when this
+I3C device has a static address and we want to assign it a specific dynamic
+address before the DAA takes place (so that other devices on the bus can't
+take this dynamic address).
+
+The I3C device should be names <device-type>@<static-address>,<i3c-pid>,

named

So the i3c-pid in the unit address is represented as a 64-bit number, not as two comma-separated 32-bit numbers?

Quoted 6 lines
Documentation/devicetree/bindings/i3c/i3c.txt new file +6 -0
+Example:
+
+       i3c-master@d040000 {
+               compatible = "cdns,i3c-master";
+               clocks = <&coreclock>, <&i3csysclock>;
+               clock-names = "pclk", "sysclk";

Documentation/devicetree/bindings/i3c/i3c.txt line 120

Quoted 10 lines
Documentation/devicetree/bindings/i3c/i3c.txt new file +10 -0
+               interrupts = <3 0>;
+               reg = <0x0d040000 0x1000>;
+               #address-cells = <3>;
+               #size-cells = <0>;
+
+               status = "okay";
+               i2c-scl-frequency = <100000>;
+
+               /* I2C device. */
+               nunchuk: nunchuk@52 {

@52,8000001000000000?

Documentation/devicetree/bindings/i3c/i3c.txt line 126

Quoted 6 lines
Documentation/devicetree/bindings/i3c/i3c.txt new file +6 -0
+                       compatible = "nintendo,nunchuk";
+                       reg = <0x52 0x80000010 0x0>;
+               };
+
+               /* I3C device with a static address. */
+               thermal_sensor: sensor@68,39200144004 {

No compatible value?

Documentation/devicetree/bindings/i3c/i3c.txt line 135

Quoted 9 lines
Documentation/devicetree/bindings/i3c/i3c.txt new file +9 -0
+                       reg = <0x68 0x392 0x144004>;
+                       assigned-address = <0xa>;
+               };
+
+               /*
+                * I3C device without a static address but requiring resources
+                * described in the DT.
+                */
+               sensor@0,39200154004 {

No compatible value?

Documentation/devicetree/bindings/i3c/i3c.txt line 139

Quoted 4 lines
Documentation/devicetree/bindings/i3c/i3c.txt new file +4 -0
+                       reg = <0x0 0x392 0x154004>;
+                       clocks = <&clock_provider 0>;
+               };
+       };

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#13 lore raw

Re: [PATCH v3 05/11] dt-bindings: i3c: Document core bindings

Hi Geert,

Quoted 19 lines · On Mon, 26 Mar 2018 12:22:24 +0200 Geert Uytterhoeven <[email protected]>…

Hi Boris,

Quoted 8 lines · Boris Brezillon

From: Boris Brezillon <[email protected]>

A new I3C subsystem has been added and a generic description has been created to represent the I3C bus and the devices connected on it.

Document this generic representation.

Thanks for your patch!

Quoted 3 lines
Documentation/devicetree/bindings/i3c/i3c.txt new file +0 -0
@@ -0,0 +1,140 @@  
Quoted 8 lines

Documentation/devicetree/bindings/i3c/i3c.txt line 70

Quoted 6 lines
Documentation/devicetree/bindings/i3c/i3c.txt new file +6 -0
+I3C devices
+===========
+
+All I3C devices are supposed to support DAA (Dynamic Address Assignment), and
+are thus discoverable. So, by default, I3C devices do not have to be described
+in the device tree.  

But if they're described, they should have a compatible value, no?

What's the point of having a compatible here? I mean, I3C devices are already attached to the relevant drivers using the Provisional ID, why would we need a compatible if we don't parse it?

Quoted 13 lines

Documentation/devicetree/bindings/i3c/i3c.txt line 80

Quoted 11 lines
Documentation/devicetree/bindings/i3c/i3c.txt new file +10 -0
+This being said, one might want to attach extra resources to these devices,
+and those resources may have to be described in the device tree, which in turn
+means we have to describe I3C devices.
+
+Another use case for describing an I3C device in the device tree is when this
+I3C device has a static address and we want to assign it a specific dynamic
+address before the DAA takes place (so that other devices on the bus can't
+take this dynamic address).
+
+The I3C device should be names <device-type>@<static-address>,<i3c-pid>,  

named

Oops. Will fix the typo.

Quoted 3 lines

So the i3c-pid in the unit address is represented as a 64-bit number, not as two comma-separated 32-bit numbers?

Right. I've changed my mind so many times that I ended up mixing the 2 representations I have considered.

Here are the choices we have:

1/ expose the raw ProvisionalID which is a 48-bit integer formed by the
concatenation of the vendor ID, part ID and instance ID:
ProvisionalID = VendorID << 33 | PartID << 16 | InstanceID << 12 |
ExtraInfo
The I3C dev node name should in this case be something like <device-type>@<static-address>,<i3c-pid>

2/ split the fields we are really interested in in different cells:
2nd cell: vendorID
3rd cell: partID
4th cell: instanceID
In this case, the node name should be <device-type>@<static-address>,<i3c-vendor>,<i3c-partid>,<i3c-instanceid>

Note that we can still change for the second representation if Rob is okay.

Quoted 11 lines
Quoted 11 lines
Documentation/devicetree/bindings/i3c/i3c.txt new file +10 -0
+Example:
+
+       i3c-master@d040000 {
+               compatible = "cdns,i3c-master";
+               clocks = <&coreclock>, <&i3csysclock>;
+               clock-names = "pclk", "sysclk";
+               interrupts = <3 0>;
+               reg = <0x0d040000 0x1000>;
+               #address-cells = <3>;
+               #size-cells = <0>;
Quoted 8 lines

Documentation/devicetree/bindings/i3c/i3c.txt line 120

Quoted 6 lines
Documentation/devicetree/bindings/i3c/i3c.txt new file +6 -0
+
+               status = "okay";
+               i2c-scl-frequency = <100000>;
+
+               /* I2C device. */
+               nunchuk: nunchuk@52 {  

@52,8000001000000000?

Well, I2C devs is a special case, and I'm not sure we want to add the extra LVR information + the IS_I2C_DEV bit in the node name.

Quoted 3 lines

Documentation/devicetree/bindings/i3c/i3c.txt line 122

Quoted 3 lines
Documentation/devicetree/bindings/i3c/i3c.txt new file +2 -0
+                       compatible = "nintendo,nunchuk";
+                       reg = <0x52 0x80000010 0x0>;

One more detail: people are unlikely to define reg using raw values: I provide macros to do that in patch 6.

Quoted 6 lines

Documentation/devicetree/bindings/i3c/i3c.txt line 126

Quoted 4 lines
Documentation/devicetree/bindings/i3c/i3c.txt new file +4 -0
+               };
+
+               /* I3C device with a static address. */
+               thermal_sensor: sensor@68,39200144004 {  

No compatible value?

No, as said above, it's not needed.

Quoted 11 lines

Documentation/devicetree/bindings/i3c/i3c.txt line 135

Quoted 10 lines
Documentation/devicetree/bindings/i3c/i3c.txt new file +9 -0
+                       reg = <0x68 0x392 0x144004>;
+                       assigned-address = <0xa>;
+               };
+
+               /*
+                * I3C device without a static address but requiring resources
+                * described in the DT.
+                */
+               sensor@0,39200154004 {  
Quoted 1 line

No compatible value?

Ditto.

Thanks for your review.

Boris

Signature · 3 lines
Boris Brezillon, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
#31 lore raw

Re: [PATCH v3 11/11] dt-bindings: gpio: Add bindings for Cadence I3C gpio expander

In reply to Geert Uytterhoeven

Hi Geert,

Quoted 10 lines · On Mon, 26 Mar 2018 12:17:26 +0200 Geert Uytterhoeven <[email protected]>…

Hi Boris,

Quoted 3 lines · Boris Brezillon

Document the Cadence I3C gpio expander bindings.

Thanks for your patch!

Quoted 16 lines
Quoted 4 lines
Documentation/devicetree/bindings/gpio/gpio-cdns-i3c.txt new file +1 -0
@@ -0,0 +1,38 @@
+* Cadence I3C GPIO expander

Documentation/devicetree/bindings/gpio/gpio-cdns-i3c.txt line 11

Quoted 10 lines
Documentation/devicetree/bindings/gpio/gpio-cdns-i3c.txt new file +10 -0
+
+The Cadence I3C GPIO expander provides 8 GPIOs controllable over I3C.
+This GPIOs can be configured in output or input mode and if they are in input
+mode they can generate IBIs (In Band Interrupts).
+
+Required properties for GPIO node:
+- reg : 3 cells encoding the I3C static address (none in our case) and the I3C
+       Provisional ID. See Documentation/devicetree/bindings/i3c/i3c.txt for
+       more details.
+       Should be <0x0 0x392 0x0>.  

No compatible value?

See my other reply.

Quoted 14 lines
Quoted 14 lines
Documentation/devicetree/bindings/gpio/gpio-cdns-i3c.txt new file +13 -0
+- gpio-controller : Marks the device node as a gpio controller.
+- #gpio-cells : Should be two. The first cell is the pin number and
+  the second cell is used to specify the gpio polarity:
+      0 = active high
+      1 = active low
+- interrupt-controller: Marks the device node as an interrupt controller.
+- #interrupt-cells : Should be 2.  The first cell is the GPIO number.
+  The second cell bits[3:0] is used to specify trigger type and level flags:
+      1 = low-to-high edge triggered.
+      2 = high-to-low edge triggered.
+      3 = triggered on both edges.
+      4 = active high level-sensitive.
+      8 = active low level-sensitive.
Quoted 8 lines

Documentation/devicetree/bindings/gpio/gpio-cdns-i3c.txt line 30

Quoted 6 lines
Documentation/devicetree/bindings/gpio/gpio-cdns-i3c.txt new file +6 -0
+
+Example:
+
+       i3c-master@xxx {
+               ...
+               i3c_gpio_expander: gpio@0,1c9,0 {  

gpio@0,392,0?

Actually, if I follow the DT bindings, it should be gpio@0,39200000000

Thanks,

Boris

Signature · 3 lines
Boris Brezillon, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
#28 lore raw

Re: [PATCH v3 11/11] dt-bindings: gpio: Add bindings for Cadence I3C gpio expander

In reply to Geert Uytterhoeven
Quoted 21 lines · On Mon, 26 Mar 2018 12:12:54 +0200 Geert Uytterhoeven <[email protected]>…

Hi Boris,

Quoted 3 lines · Boris Brezillon

Document the Cadence I3C gpio expander bindings.

Thanks for your patch!

Documentation/devicetree/bindings/gpio/gpio-cdns-i3c.txt line 24

Quoted 10 lines
Documentation/devicetree/bindings/gpio/gpio-cdns-i3c.txt new file +7 -0
 
+- #interrupt-cells : Should be 2.  The first cell is the GPIO number.
+  The second cell bits[3:0] is used to specify trigger type and level flags:
+      1 = low-to-high edge triggered.
+      2 = high-to-low edge triggered.
+      3 = triggered on both edges.
+      4 = active high level-sensitive.
+      8 = active low level-sensitive.  
Quoted 2 lines

These are identical to the values in <dt-bindings/interrupt-controller/irq.h>. Perhaps you can refer to those definitions?

Well, I'm not sure this is allowed since DT bindings docs are supposed to be OS-agnostic and macros defined in <dt-bindings/interrupt-controller/irq.h> are, AFAIK, only available to Linux.

Note that I copied these definitions from another binding ;-).

Rob, any opinion?

Signature · 3 lines
Boris Brezillon, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
#29 lore raw

Re: [PATCH v3 11/11] dt-bindings: gpio: Add bindings for Cadence I3C gpio expander

Hi Boris,

Quoted 21 lines · Boris Brezillon
Quoted 19 lines · On Mon, 26 Mar 2018 12:12:54 +0200 Geert Uytterhoeven <[email protected]>…
Quoted 3 lines · Boris Brezillon

Document the Cadence I3C gpio expander bindings.

Thanks for your patch!

Quoted 10 lines
Documentation/devicetree/bindings/gpio/gpio-cdns-i3c.txt new file +7 -0
 
+- #interrupt-cells : Should be 2.  The first cell is the GPIO number.
+  The second cell bits[3:0] is used to specify trigger type and level flags:
+      1 = low-to-high edge triggered.
+      2 = high-to-low edge triggered.
+      3 = triggered on both edges.
+      4 = active high level-sensitive.
+      8 = active low level-sensitive.
Quoted 7 lines
Quoted 2 lines

These are identical to the values in <dt-bindings/interrupt-controller/irq.h>. Perhaps you can refer to those definitions?

Well, I'm not sure this is allowed since DT bindings docs are supposed to be OS-agnostic and macros defined in <dt-bindings/interrupt-controller/irq.h> are, AFAIK, only available to Linux.

If they're under include/dt-bindings/, they're part of the DT bindings.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
maintainer
#14 lore raw

Re: [PATCH v3 05/11] dt-bindings: i3c: Document core bindings

In reply to Boris Brezillon
Quoted 6 lines · Boris Brezillon

From: Boris Brezillon <[email protected]>

A new I3C subsystem has been added and a generic description has been created to represent the I3C bus and the devices connected on it.

Document this generic representation.

Mostly looks fine, a couple of clarifications below.

Quoted 91 lines

---
Changes in v3:
- Rename {i2c,i3c}-scl-frequency DT prop into {i2c,i3c}-scl-hz
- Rework the way we expose the provisional ID and LVR information
- Rename dynamic-address into assigned-address
- Enforce the I3C master node name

Changes in v2:
- Define how to describe I3C devices in the DT and when it should be used. Note that the parsing of I3C devices is not yet implemented in the framework. Will be added when someone really needs it.

---
 Documentation/devicetree/bindings/i3c/i3c.txt | 140 ++++++++++++++++++++++++++
 1 file changed, 140 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/i3c/i3c.txt
Documentation/devicetree/bindings/i3c/i3c.txt new file +67 -0
new file mode 100644
index 000000000000..ed858228d26b
@@ -0,0 +1,140 @@
+Generic device tree bindings for I3C busses
+===========================================
+
+This document describes generic bindings that should be used to describe I3C
+busses in a device tree.
+
+Required properties
+-------------------
+
+- #address-cells  - should be <3>. Read more about addresses below.
+- #size-cells     - should be <0>.
+- compatible      - name of the I3C master controller driving the I3C bus
+
+For other required properties e.g. to describe register sets,
+clocks, etc. check the binding documentation of the specific driver.
+The node describing an I3C bus should be named i3c-master.
+
+Optional properties
+-------------------
+
+These properties may not be supported by all I3C master drivers. Each I3C
+master bindings should specify which of them are supported.
+
+- i3c-scl-hz: frequency of the SCL signal used for I3C transfers.
+	      When undefined the core sets it to 12.5MHz.
+
+- i2c-scl-hz: frequency of the SCL signal used for I2C transfers.
+	      When undefined, the core looks at LVR (Legacy Virtual Register)
+	      values of I2C devices described in the device tree to determine
+	      the maximum I2C frequency.
+
+I2C devices
+===========
+
+Each I2C device connected to the bus should be described in a subnode. All
+properties described in Documentation/devicetree/bindings/i2c/i2c.txt are
+valid here, but several new properties have been added.
+
+New constraint on existing properties:
+--------------------------------------
+- reg: contains 3 cells
+  + first cell : still encoding the I2C address
+
+  + second cell: should have bit 31 set to 1 signify that this is an I2C
+		 device. Bits 0 to 7 encode the I3C LVR (Legacy Virtual
+		 Register):
+
+	bit[7:5]: I2C device index. Possible values
+	* 0: I2C device has a 50 ns spike filter
+	* 1: I2C device does not have a 50 ns spike filter but supports high
+	     frequency on SCL
+	* 2: I2C device does not have a 50 ns spike filter and is not tolerant
+	     to high frequencies
+	* 3-7: reserved
+
+	bit[4]: tell whether the device operates in FM (Fast Mode) or FM+ mode
+	* 0: FM+ mode
+	* 1: FM mode
+
+	bit[3:0]: device type
+	* 0-15: reserved
+
+  + third cell: should be 0
+
+I3C devices
+===========
+

Documentation/devicetree/bindings/i3c/i3c.txt line 77

Quoted 10 lines
Documentation/devicetree/bindings/i3c/i3c.txt new file +10 -0
+All I3C devices are supposed to support DAA (Dynamic Address Assignment), and
+are thus discoverable. So, by default, I3C devices do not have to be described
+in the device tree.
+This being said, one might want to attach extra resources to these devices,
+and those resources may have to be described in the device tree, which in turn
+means we have to describe I3C devices.
+
+Another use case for describing an I3C device in the device tree is when this
+I3C device has a static address and we want to assign it a specific dynamic
+address before the DAA takes place (so that other devices on the bus can't

static is I2C address and dynamic is an I3C address. That could be clearer throughout.

Documentation/devicetree/bindings/i3c/i3c.txt line 80

Quoted 3 lines
Documentation/devicetree/bindings/i3c/i3c.txt new file +3 -0
+take this dynamic address).
+
+The I3C device should be names <device-type>@<static-address>,<i3c-pid>,

s/static-address/static-i2c-address/

Documentation/devicetree/bindings/i3c/i3c.txt line 88

Quoted 8 lines
Documentation/devicetree/bindings/i3c/i3c.txt new file +8 -0
+where device-type is describing the type of device connected on the bus
+(gpio-controller, sensor, ...).
+
+Required properties
+-------------------
+- reg: contains 3 cells
+  + first cell : encodes the I2C address. Should be 0 if the device does not
+		 have one (0 is not a valid I3C address).

Change here to "encodes the static I2C address".

0 is not a valid I2C address?

Quoted 55 lines
Documentation/devicetree/bindings/i3c/i3c.txt new file +52 -0
+
+  + second and third cells: should encode the ProvisionalID. The second cell
+			    contains the manufacturer ID left-shifted by 1.
+			    The third cell contains ORing of the part ID
+			    left-shifted by 16, the instance ID left-shifted
+			    by 12 and the extra information. This encoding is
+			    following the PID definition provided by the I3C
+			    specification.
+
+Optional properties
+-------------------
+- assigned-address: dynamic address to be assigned to this device. This
+		    property is only valid if the I3C device has a static
+		    address (first cell of the reg property != 0).
+
+
+Example:
+
+	i3c-master@d040000 {
+		compatible = "cdns,i3c-master";
+		clocks = <&coreclock>, <&i3csysclock>;
+		clock-names = "pclk", "sysclk";
+		interrupts = <3 0>;
+		reg = <0x0d040000 0x1000>;
+		#address-cells = <3>;
+		#size-cells = <0>;
+
+		status = "okay";
+		i2c-scl-frequency = <100000>;
+
+		/* I2C device. */
+		nunchuk: nunchuk@52 {
+			compatible = "nintendo,nunchuk";
+			reg = <0x52 0x80000010 0x0>;
+		};
+
+		/* I3C device with a static address. */
+		thermal_sensor: sensor@68,39200144004 {
+			reg = <0x68 0x392 0x144004>;
+			assigned-address = <0xa>;
+		};
+
+		/*
+		 * I3C device without a static address but requiring resources
+		 * described in the DT.
+		 */
+		sensor@0,39200154004 {
+			reg = <0x0 0x392 0x154004>;
+			clocks = <&clock_provider 0>;
+		};
+	};
+
Signature · 1 line
2.14.1
maintainer Reviewed-by on v3 6/11
#19 lore raw

Re: [PATCH v3 06/11] dt-bindings: i3c: Add macros to help fill I3C/I2C device's reg property

In reply to Boris Brezillon
Quoted 9 lines · Boris Brezillon

The reg property of devices connected to an I3C bus have 3 cells, and filling them manually is not trivial. Provides macros to help doing that.

---
 include/dt-bindings/i3c/i3c.h | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 include/dt-bindings/i3c/i3c.h
maintainer
#32 lore raw

Re: [PATCH v3 11/11] dt-bindings: gpio: Add bindings for Cadence I3C gpio expander

In reply to Boris Brezillon
Quoted 34 lines · Boris Brezillon

Document the Cadence I3C gpio expander bindings.

---
 .../devicetree/bindings/gpio/gpio-cdns-i3c.txt     | 38 ++++++++++++++++++++++
 1 file changed, 38 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpio/gpio-cdns-i3c.txt
Documentation/devicetree/bindings/gpio/gpio-cdns-i3c.txt new file +20 -0
new file mode 100644
index 000000000000..634b1f268215
@@ -0,0 +1,38 @@
+* Cadence I3C GPIO expander
+
+The Cadence I3C GPIO expander provides 8 GPIOs controllable over I3C.
+This GPIOs can be configured in output or input mode and if they are in input
+mode they can generate IBIs (In Band Interrupts).
+
+Required properties for GPIO node:
+- reg : 3 cells encoding the I3C static address (none in our case) and the I3C
+	Provisional ID. See Documentation/devicetree/bindings/i3c/i3c.txt for
+	more details.
+	Should be <0x0 0x392 0x0>.
+- gpio-controller : Marks the device node as a gpio controller.
+- #gpio-cells : Should be two. The first cell is the pin number and
+  the second cell is used to specify the gpio polarity:
+      0 = active high
+      1 = active low
+- interrupt-controller: Marks the device node as an interrupt controller.
+- #interrupt-cells : Should be 2.  The first cell is the GPIO number.
+  The second cell bits[3:0] is used to specify trigger type and level flags:
+      1 = low-to-high edge triggered.

Documentation/devicetree/bindings/gpio/gpio-cdns-i3c.txt line 30

Quoted 10 lines
Documentation/devicetree/bindings/gpio/gpio-cdns-i3c.txt new file +10 -0
+      2 = high-to-low edge triggered.
+      3 = triggered on both edges.
+      4 = active high level-sensitive.
+      8 = active low level-sensitive.
+
+Example:
+
+	i3c-master@xxx {
+		...
+		i3c_gpio_expander: gpio@0,1c9,0 {

The unit address is wrong here.

Quoted 11 lines
Documentation/devicetree/bindings/gpio/gpio-cdns-i3c.txt new file +8 -0
+			reg = <0 0x392 0x0>;
+			gpio-controller;
+			#gpio-cells = <2>;
+			interrupt-controller;
+			#interrupt-cells = <2>;
+		};
+		...
+	};
Signature · 1 line
2.14.1
#15 lore raw

Re: [PATCH v3 05/11] dt-bindings: i3c: Document core bindings

In reply to Rob Herring

Hi Rob,

Quoted 9 lines · On Mon, 26 Mar 2018 17:24:58 -0500 Rob Herring <[email protected]> wrote:
Quoted 9 lines
Documentation/devicetree/bindings/i3c/i3c.txt new file +9 -0
+
+I3C devices
+===========
+
+All I3C devices are supposed to support DAA (Dynamic Address Assignment), and
+are thus discoverable. So, by default, I3C devices do not have to be described
+in the device tree.
+This being said, one might want to attach extra resources to these devices,
+and those resources may have to be described in the device tree, which in turn
Quoted 8 lines

Documentation/devicetree/bindings/i3c/i3c.txt line 77

Quoted 5 lines
Documentation/devicetree/bindings/i3c/i3c.txt new file +5 -0
+means we have to describe I3C devices.
+
+Another use case for describing an I3C device in the device tree is when this
+I3C device has a static address and we want to assign it a specific dynamic
+address before the DAA takes place (so that other devices on the bus can't  

static is I2C address and dynamic is an I3C address. That could be clearer throughout.

I'll clarify that.

Quoted 6 lines

Documentation/devicetree/bindings/i3c/i3c.txt line 80

Quoted 4 lines
Documentation/devicetree/bindings/i3c/i3c.txt new file +3 -0
+take this dynamic address).
+
+The I3C device should be names <device-type>@<static-address>,<i3c-pid>,  

s/static-address/static-i2c-address/

Okay.

Quoted 12 lines

Documentation/devicetree/bindings/i3c/i3c.txt line 88

Quoted 9 lines
Documentation/devicetree/bindings/i3c/i3c.txt new file +8 -0
+where device-type is describing the type of device connected on the bus
+(gpio-controller, sensor, ...).
+
+Required properties
+-------------------
+- reg: contains 3 cells
+  + first cell : encodes the I2C address. Should be 0 if the device does not
+		 have one (0 is not a valid I3C address).  

Change here to "encodes the static I2C address".

Quoted 1 line

0 is not a valid I2C address?

According to [1] it is reserved, and it's reserved in the I3C spec anyway (see "Table 9 I3C Slave Address Restrictions" in the I3C spec).

Quoted 9 lines

Documentation/devicetree/bindings/i3c/i3c.txt line 96

Quoted 9 lines
Documentation/devicetree/bindings/i3c/i3c.txt new file +8 -0
+
+  + second and third cells: should encode the ProvisionalID. The second cell
+			    contains the manufacturer ID left-shifted by 1.
+			    The third cell contains ORing of the part ID
+			    left-shifted by 16, the instance ID left-shifted
+			    by 12 and the extra information. This encoding is
+			    following the PID definition provided by the I3C
+			    specification.

One extra question for you: should I refer to the I3C_DEV(), I3C_DEV_WITH_STATIC_ADDR() and I2C_DEV() macros in the bindings doc? And if I do, should I use them my example?

Thanks,

Boris

Quoted 39 lines
Quoted 39 lines
Documentation/devicetree/bindings/i3c/i3c.txt new file +39 -0
+
+Optional properties
+-------------------
+- assigned-address: dynamic address to be assigned to this device. This
+		    property is only valid if the I3C device has a static
+		    address (first cell of the reg property != 0).
+
+
+Example:
+
+	i3c-master@d040000 {
+		compatible = "cdns,i3c-master";
+		clocks = <&coreclock>, <&i3csysclock>;
+		clock-names = "pclk", "sysclk";
+		interrupts = <3 0>;
+		reg = <0x0d040000 0x1000>;
+		#address-cells = <3>;
+		#size-cells = <0>;
+
+		status = "okay";
+		i2c-scl-frequency = <100000>;
+
+		/* I2C device. */
+		nunchuk: nunchuk@52 {
+			compatible = "nintendo,nunchuk";
+			reg = <0x52 0x80000010 0x0>;
+		};
+
+		/* I3C device with a static address. */
+		thermal_sensor: sensor@68,39200144004 {
+			reg = <0x68 0x392 0x144004>;
+			assigned-address = <0xa>;
+		};
+
+		/*
+		 * I3C device without a static address but requiring resources
+		 * described in the DT.
+		 */
+		sensor@0,39200154004 {
Quoted 8 lines
Quoted 8 lines
Documentation/devicetree/bindings/i3c/i3c.txt new file +5 -0
+			reg = <0x0 0x392 0x154004>;
+			clocks = <&clock_provider 0>;
+		};
+	};
+
Signature · 1 line
2.14.1

[1]http://www.i2c-bus.org/addressing

Signature · 3 lines
Boris Brezillon, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
maintainer
#16 lore raw

Re: [PATCH v3 05/11] dt-bindings: i3c: Document core bindings

Quoted 46 lines · Boris Brezillon

Hi Rob,

Quoted 9 lines · On Mon, 26 Mar 2018 17:24:58 -0500 Rob Herring <[email protected]> wrote:
Quoted 9 lines
Documentation/devicetree/bindings/i3c/i3c.txt new file +9 -0
+
+I3C devices
+===========
+
+All I3C devices are supposed to support DAA (Dynamic Address Assignment), and
+are thus discoverable. So, by default, I3C devices do not have to be described
+in the device tree.
+This being said, one might want to attach extra resources to these devices,
+and those resources may have to be described in the device tree, which in turn
Quoted 8 lines

Documentation/devicetree/bindings/i3c/i3c.txt line 77

Quoted 5 lines
Documentation/devicetree/bindings/i3c/i3c.txt new file +5 -0
+means we have to describe I3C devices.
+
+Another use case for describing an I3C device in the device tree is when this
+I3C device has a static address and we want to assign it a specific dynamic
+address before the DAA takes place (so that other devices on the bus can't

static is I2C address and dynamic is an I3C address. That could be clearer throughout.

I'll clarify that.

Quoted 6 lines

Documentation/devicetree/bindings/i3c/i3c.txt line 80

Quoted 4 lines
Documentation/devicetree/bindings/i3c/i3c.txt new file +3 -0
+take this dynamic address).
+
+The I3C device should be names <device-type>@<static-address>,<i3c-pid>,

s/static-address/static-i2c-address/

Okay.

Quoted 12 lines

Documentation/devicetree/bindings/i3c/i3c.txt line 88

Quoted 9 lines
Documentation/devicetree/bindings/i3c/i3c.txt new file +8 -0
+where device-type is describing the type of device connected on the bus
+(gpio-controller, sensor, ...).
+
+Required properties
+-------------------
+- reg: contains 3 cells
+  + first cell : encodes the I2C address. Should be 0 if the device does not
+            have one (0 is not a valid I3C address).

Change here to "encodes the static I2C address".

Quoted 4 lines
Quoted 1 line

0 is not a valid I2C address?

According to [1] it is reserved, and it's reserved in the I3C spec anyway (see "Table 9 I3C Slave Address Restrictions" in the I3C spec).

Sorry, what I meant was s/I3C/I2C/. The first cell is I2C address and 0 is not valid.

Quoted 9 lines
Quoted 8 lines

Documentation/devicetree/bindings/i3c/i3c.txt line 96

Quoted 8 lines
Documentation/devicetree/bindings/i3c/i3c.txt new file +8 -0
+
+  + second and third cells: should encode the ProvisionalID. The second cell
+                       contains the manufacturer ID left-shifted by 1.
+                       The third cell contains ORing of the part ID
+                       left-shifted by 16, the instance ID left-shifted
+                       by 12 and the extra information. This encoding is
+                       following the PID definition provided by the I3C
+                       specification.
Quoted 3 lines

One extra question for you: should I refer to the I3C_DEV(), I3C_DEV_WITH_STATIC_ADDR() and I2C_DEV() macros in the bindings doc? And if I do, should I use them my example?

Well, I don't want to see "device@I3C_DEV(...)" for unit-addresses. You can use them for reg property, but it's somewhat pointless to use it in one place and not the other.

Rob

#17 lore raw

Re: [PATCH v3 05/11] dt-bindings: i3c: Document core bindings

Quoted 12 lines · On Wed, 28 Mar 2018 11:42:07 -0500 Rob Herring <[email protected]> wrote:
Quoted 12 lines
Quoted 12 lines

Documentation/devicetree/bindings/i3c/i3c.txt line 88

Quoted 9 lines
Documentation/devicetree/bindings/i3c/i3c.txt new file +8 -0
+where device-type is describing the type of device connected on the bus
+(gpio-controller, sensor, ...).
+
+Required properties
+-------------------
+- reg: contains 3 cells
+  + first cell : encodes the I2C address. Should be 0 if the device does not
+            have one (0 is not a valid I3C address).  

Change here to "encodes the static I2C address".

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

0 is not a valid I2C address?

According to [1] it is reserved, and it's reserved in the I3C spec anyway (see "Table 9 I3C Slave Address Restrictions" in the I3C spec).

Sorry, what I meant was s/I3C/I2C/. The first cell is I2C address and 0 is not valid.

Okay, got it now :-).

Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
Quoted 9 lines
Documentation/devicetree/bindings/i3c/i3c.txt new file +8 -0
+
+  + second and third cells: should encode the ProvisionalID. The second cell
+                       contains the manufacturer ID left-shifted by 1.
+                       The third cell contains ORing of the part ID
+                       left-shifted by 16, the instance ID left-shifted
+                       by 12 and the extra information. This encoding is
+                       following the PID definition provided by the I3C
+                       specification.  
Quoted 5 lines
Quoted 3 lines

One extra question for you: should I refer to the I3C_DEV(), I3C_DEV_WITH_STATIC_ADDR() and I2C_DEV() macros in the bindings doc? And if I do, should I use them my example?

Well, I don't want to see "device@I3C_DEV(...)" for unit-addresses.

That wouldn't work anyway.

Quoted 2 lines

You can use them for reg property, but it's somewhat pointless to use it in one place and not the other.

Not sure I follow you. These macros have been added to ease definitions of reg, but you'll still have to manually define the unit-address manually. Are you saying I should not use them in dts files or just that I should not mention it in the doc. If this is the former, then patch 6 should be dropped.

Signature · 3 lines
Boris Brezillon, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com