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>
Add the parameters crcaps and crhdly1 in to the i3c device descriptor.
Also, retrieve the values if they are available.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
Implement the hj_response api for STM32 I3C. This also implements
the PM calls for enabling and disabling runtime PM. For HJ to work
the device must be powered on and be receiving a clock.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
When attaching a device, it should look up if the dynamic addr is
already attached only, and not by the static addr.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
For ENTDAA, BCR and DCR is always transmitted back up to the controller.
When `i3c_bus_init` is done, it does the ENTDAA then it would get the
basic info would get the BCR and DCR again. This was rather reduntant.
This now splits it up so there is a function called
`i3c_device_adv_info_get` which gets the mrl, mwl, getcaps, and the
mxds. `i3c_device_basic_info_get` now only just gets the bcr and dcr.
There is also an inline function called `i3c_device_info_get` which
will get everything.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
Use shell_device_get_binding() instead of device_get_binding() so that
we get the device based on its name and in addition by its label.
Signed-off-by: Yishai Jaffe <yishai1999@gmail.com>