The bus helpers for SETDASA and SETNEWDA could have the same
dynamic address assigned as it's static addr for SETDASA or
as it's dynamic addr for SETNEWDA. (Althrough, only a clown
would set the new dynamic address to the same old dynamic
address, it is still a valid address to set to).
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
Utilize a code spell-checking tool to scan for and correct spelling errors
in `Kconfig` files within the `drivers` directory.
Additionally, incorporates a fix recommended by the reviewer.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
Create bus helpers that will send ccc commands as well as update
items within the i3c descriptor. These are different than the
direct ccc functions as these can give a bit of convience to also
updating the descriptor.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
Updated the CONF_STATUS0_DEV_ROLE macro to ensure proper bitwise
operation by adding parentheses around the bitmask operation.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
I3C callbacks are registered by upper layer. Driver layer must check if
a callback is not NULL before calling it
Signed-off-by: Nghia Phung <nghiap@amperecomputing.com>
When Hotjoin complete and dynamic address is assigned to target,
INTR_DYN_ADDR_ASSGN_STAT interrupt will be triggered, we can use sem_hj
to notify dw_i3c_target_ibi_raise_hj() about Hotjoin completion
Signed-off-by: Nghia Phung <nghiap@amperecomputing.com>
This patch introduces handling for the target reset request (RSTACT)
in the I3C controller.
It enables the controller to send a broadcast RSTACT command along with
the target reset pattern in a single frame.
Signed-off-by: Alvis Sun <yfsun@nuvoton.com>
It's possible if a device is an i3c v1.0 spec, no hdr, no mxds,
no controller caps, and does not have a mrl nor mwl. It should
return 0 if it doesn't need to do anything.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
If the BCR value is not set for ibi w/ payload, then it still
has a ibi length of 1 due to the MDB. Set the PL accordingly.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
rtio_cqe_consume() may return NULL so we need to check before
using any members of the returned struct.
Fixes#90473Fixes#90489Fixes#90497
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Coverity flagged that the return variable ret may not be
initialized when returning. So give it a default value.
Fixes#90509
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Fixes trivial typo
Co-authored-by: Harry Martin <48959255+Harry-Martin@users.noreply.github.com>
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
The logic of clock initialization for i2c fast mode (FM) and fast
mode plus (FMP) is as follows:
1 compute how many system clock cycles for SCL to be low
2 compute how many system clock cycles for SCL to be high by
subtracting the low duration computed above from the SCL period
3 verify the high duration computed in 2 is larger than a minimum
The bug is that the step 3 for the FMP is compared with the
minimum value for FM, and causes it to fail.
The fix corrects the bug.
Signed-off-by: Hu Dou <hugh.dou@gmail.com>
In I3C v1.0, there was a RSTDAA direct CCC. It is deprecated in I3C v1.1
and later. This adds a CCC helper for it.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
This adds a v1.0 support dts flag for devices. This also makes it so it
doesn't try to send a GETCAPS (GETHDRCAP) ccc if this flag is set and it
doesn't support any HDR modes.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
I3C can contain a lot of features that may be unused. Add Kconfigs for
enabling controller and/or target code. Choosing just one can reduce
the code size footprint.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
For the broadcast setwml ccc, the argument vector index of the input
length is 2 instead of 3. This commit fixs this issue.
Signed-off-by: Ren Chen <Ren.Chen@ite.com.tw>
Add a way to assign the dynamic address for a primary controller. This
is the address that is broadcasted out with the ccc DEFTGTS, and is the
address that secondary controllers use to communicate with the primary
controller.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
The datasheet erroneously suggested to add a + 1 to the abort len.
This was suggested because if a controller gave a EoD, then it was
afraid that the abort would take precedence over the EoD. This was
not true. The EoD will always take precedence over a controller
abort. Remove the + 1 as this can cause issues.
For example, when talking to a part that will auto-increment a read
address, having the +1 can unknownly move this address pointer further
than anticipated.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
It is most certainly 'okay' for a secondary controller to do a
ENTDAA. Remove the 'block' that was preventing this.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
The i3c group address support is rather very incomplete here. Remove
references to it. This could all easily come back when/if group support
comes in.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
There is const used in a few places and some hacks to get around
that const. Just remove the const as well as remove the hacks.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
If the bus is only used I2C we can skip I3C bus initialization which
will send a number of unnecessary CCC transactions.
Signed-off-by: Corey Wharton <xodus7@cwharton.com>
The current value of 1s is much too long, default to 100ms instead
which is enough for even a large 4kB FM I2C transfer to finish in
time let alone a typical I3C transfer. Make this configurable in
case projects want to tune this.
Signed-off-by: Corey Wharton <xodus7@cwharton.com>
The maximum number of attached devices is limited by the maximum
number of entries in the device address table. For I3C devices
these have to by allocated permanently when devices are attached
but for I2C devices we can dynamically allocate an entry in the
table on a I2C transfer and free it after the transfer is completed.
This allows the maximum number of I2C + I3C devices on a bus to be
larger than the address table size as long as the number of I3C
devices is maxdevs - 1.
Signed-off-by: Corey Wharton <xodus7@cwharton.com>
Adds pinctrl support on init and on PM actions. General PM support is added
to the driver to enable the later.
Signed-off-by: Corey Wharton <xodus7@cwharton.com>
The errno for format 2 of the getstatus ccc always returns an error.
The check for the invalid defining byte should use the "AND" operation
instead of "OR." Additionally, the first byte of the ibi tir sending
request is ignored due to the incorrect argument count.
This commit fixes both issues.
Signed-off-by: Ren Chen <Ren.Chen@ite.com.tw>
There is an incorrect dynamic address setting for setaasa. The correct
behavior is that the dynamic address should be assigned as a static
address only when the CCC request returns success. This commit fixes the
issue.
Signed-off-by: Ren Chen <Ren.Chen@ite.com.tw>
It shouldn't be possible to just 'enable' target mode of a device.
It is required by the specification to perform a handoff or request to
become a target or controller from the active controller. Not to just flip
a switch internally. Can the parameter from `enable` to `enabled` to report
if it is currently a target or a controller otherwise.
Also, add inline helpers for `i3c_config_get` and `i3c_configure` to ensure
the proper struct is passed in.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
The dts define for the ibi threshold (watermark) was be written to the
ibi response threshold. Fix it to write to the correct spot.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
deftgts could be a different length the second time around. Also, be
more efficient rather than just allocaing the max_devs each time.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>