Commit graph

14 commits

Author SHA1 Message Date
Ryan McClelland 9640905a71 drivers: i3c: add ccc getcaps helper
This adds the defines for getcaps format 1 and format 2.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2024-05-16 16:23:31 +02:00
Ryan McClelland da094d4d3c drivers: i3c: fix ccc getmxds macros
GETMXDS macros had typos in them. This fixes them.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2024-05-16 16:23:31 +02:00
Pieter De Gendt 7ad76e598f include: drivers: Add missing __subsystem tags
Add __subsystem tags to driver API structs.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-05-03 14:44:41 +01:00
Ryan McClelland 78e961998a drivers: i3c: add additional variable for num xfer for i3c
With I3C, when a controller does a read whether, through a private transfer
or a CCC, the target is responsible for issuing the End of Data through the
T bit, but the way the API is currently implemented, there is no way to
communicate this back up. For example, if a controller tries to read 100
Bytes (where the controller is to do an abort after 100 (or 101 bytes))
from a Target and the Target gives the EoD at the 42nd Byte, then there is
no way to currently know where the EoD occurred and how far it can be read
up to in the provided buffers.

This implements a num_xfer for `i3c_msg` and `i3c_ccc_payload` which the
driver is responsible for writing the total number of bytes transferred.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2023-12-04 16:48:20 +01:00
Ryan McClelland 9ddc94e0d4 drivers: i3c: specify start addr when searching for a free addr
For example, if a driver needed to reserve address before it does a
ENTDAA, it would need to get free address in a loop, but the get
free address func would return the same address everytime. It needs
the start address, which would be the last free address it go, to
be passed in to get the next free address.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2023-11-13 09:43:26 +01:00
Daniel Leung c91a572b0e i3c: some doxygen API doc polishing
This polishes the doxygen doc on I3C API to make it,
hopefully, more usable. Fixed some typos too.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-10-09 10:15:49 +02:00
Ryan McClelland 62f22f8d3b drivers: i3c: i3c attach/detach api
There are some needs to attach and reattach i3c/i2c devices at runtime
Some I2C devices can have special registers where the address can be
changed at runtime. Also some I3C devices can be powered off at runtime
freeing up the address space they take up. These new APIs allow for these
to be changed at runtime. This also moves some config/data in to a common
i3c config/data structure which would allow the api to operate on to be
common for all I3C drivers.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2023-03-29 07:46:37 -04:00
Ryan McClelland 1f757bc67f drivers: i3c: add SETNEWDA ccc helper function
This is a ccc helper function for setting a new dynamic addr for
a Target.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2023-03-29 07:46:37 -04:00
Ryan McClelland 59ee3f1a79 i3c: fix macro generation with multiple devices
When generating an array of devices with I3C_DEVICE_ARRAY_DT_INST
and I3C_I2C_DEVICE_ARRAY_DT_INST when the number of devices is
greater than 1, a comma was not inserted between each struct with
macro. This would give an error preventing compiling.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2022-12-12 15:51:16 -05:00
Ryan McClelland 1eb3f15d11 i3c: add write to tx fifo target api
Some controllers will "automatically" NACK any read request to them
if there is no data in the TX FIFO. This would prevent use of the callback
function read_requested_cb which is expected to be called from an ISR.
i3c_target_tx_write was added to give applications a direct way to load
data in to the tx fifo.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2022-12-12 15:51:16 -05:00
Gerard Marull-Paretas 92c9db2e82 device: rename some *DEVICE*DEFINE* arguments
drv_name -> name
pm_device -> pm
data_ptr -> data
cfg_ptr -> config
api_ptr -> api
state_ptr -> state

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-04 10:13:34 +02:00
Daniel Leung 66a9a15104 i3c: add a global workqueue for IBI
Adds support for a global workqueue so drivers can defer
IBI callbacks instead of doing it in interrupt context.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-09-09 17:42:33 -04:00
Daniel Leung 1493285912 i3c: add API for controller to act as target device
This adds the bits to allow an I3C controller to act as target
device. This is modelled after the I2C target model.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-09-09 17:42:33 -04:00
Daniel Leung ce7058d2f5 drivers: i3c: introduce I3C API for controllers
This introduces the I3C API for I3C controllers. Currently,
this supports one controller per bus under Zephyr.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-09-09 17:42:33 -04:00