[RFC PATCH 0/9] I3C Slave Mode support

From: Frank Li
Date: Tue Sep 05 2023 - 17:39:10 EST


This RFC patch introduces support for I3C slave mode, which is referenced
with a PCIe Endpoint system. It also establishes a configuration framework
(configfs) for the I3C slave controller driver and the I3C slave function
driver

Typic usage as

The user can configure the i3c-slave-tty device using configfs entry. In
order to change the vendorid, the following commands can be used

# echo 0x011b > functions/tty/func1/vendor_id
# echo 0x1000 > functions/tty/func1/part_id
# echo 0x6 > functions/tty/t/bcr

Binding i3c-slave-tty Device to slave Controller
------------------------------------------------

In order for the slave function device to be useful, it has to be bound to
a I3C slave controller driver. Use the configfs to bind the function
device to one of the controller driver present in the system::

# ln -s functions/pci_epf_test/func1 controllers/44330000.i3c-slave/

Host side:
cat /dev/ttyI3C0
Slave side:
echo abc >/dev/ttyI3C0

These patches have not full implemented, especially at tty driver side.

But it does not impact to review i3c slave part, especially data transfer
and configfs.

Frank Li (9):
i3c: add actual in i3c_priv_xfer
i3c: svc: rename read_len as actual_len
i3c: master: svc return actual transfer data len
dt-bindings: i3c: svc: add compatible string i3c: silvaco,i3c-slave-v1
i3c: add slave mode support
i3c: slave: add svc slave controller support
i3c: slave: func: add tty driver
tty: serial: add tty over I3C master side driver
Documentation: i3c: Add I3C slave mode controller and function

.../bindings/i3c/silvaco,i3c-master.yaml | 7 +-
Documentation/driver-api/i3c/index.rst | 1 +
.../driver-api/i3c/slave/i3c-slave-cfs.rst | 109 ++++
.../driver-api/i3c/slave/i3c-slave.rst | 189 ++++++
.../driver-api/i3c/slave/i3c-tty-function.rst | 103 +++
.../driver-api/i3c/slave/i3c-tty-howto.rst | 109 ++++
Documentation/driver-api/i3c/slave/index.rst | 13 +
drivers/i3c/Kconfig | 30 +
drivers/i3c/Makefile | 4 +
drivers/i3c/func/Kconfig | 9 +
drivers/i3c/func/Makefile | 3 +
drivers/i3c/func/tty.c | 345 ++++++++++
drivers/i3c/i3c-cfs.c | 361 +++++++++++
drivers/i3c/master/svc-i3c-master.c | 52 +-
drivers/i3c/slave.c | 441 +++++++++++++
drivers/i3c/slave/Kconfig | 9 +
drivers/i3c/slave/Makefile | 4 +
drivers/i3c/slave/svc-i3c-slave.c | 600 ++++++++++++++++++
drivers/tty/serial/Kconfig | 6 +
drivers/tty/serial/Makefile | 1 +
drivers/tty/serial/ttyi3c.c | 276 ++++++++
include/linux/i3c/device.h | 1 +
include/linux/i3c/slave.h | 458 +++++++++++++
23 files changed, 3109 insertions(+), 22 deletions(-)
create mode 100644 Documentation/driver-api/i3c/slave/i3c-slave-cfs.rst
create mode 100644 Documentation/driver-api/i3c/slave/i3c-slave.rst
create mode 100644 Documentation/driver-api/i3c/slave/i3c-tty-function.rst
create mode 100644 Documentation/driver-api/i3c/slave/i3c-tty-howto.rst
create mode 100644 Documentation/driver-api/i3c/slave/index.rst
create mode 100644 drivers/i3c/func/Kconfig
create mode 100644 drivers/i3c/func/Makefile
create mode 100644 drivers/i3c/func/tty.c
create mode 100644 drivers/i3c/i3c-cfs.c
create mode 100644 drivers/i3c/slave.c
create mode 100644 drivers/i3c/slave/Kconfig
create mode 100644 drivers/i3c/slave/Makefile
create mode 100644 drivers/i3c/slave/svc-i3c-slave.c
create mode 100644 drivers/tty/serial/ttyi3c.c
create mode 100644 include/linux/i3c/slave.h

--
2.34.1