drivers: i3c: add rstdaa direct helper
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 commit is contained in:
parent
2e8c911fa3
commit
c0503597ba
2 changed files with 44 additions and 1 deletions
|
@ -137,6 +137,26 @@ int i3c_ccc_do_rstact(const struct i3c_device_desc *target,
|
||||||
return i3c_do_ccc(target->bus, &ccc_payload);
|
return i3c_do_ccc(target->bus, &ccc_payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int i3c_ccc_do_rstdaa(struct i3c_device_desc *target)
|
||||||
|
{
|
||||||
|
struct i3c_ccc_payload ccc_payload;
|
||||||
|
struct i3c_ccc_target_payload ccc_tgt_payload;
|
||||||
|
|
||||||
|
__ASSERT_NO_MSG(target != NULL);
|
||||||
|
__ASSERT_NO_MSG(target->bus != NULL);
|
||||||
|
|
||||||
|
ccc_tgt_payload.addr = target->dynamic_addr;
|
||||||
|
ccc_tgt_payload.rnw = 1;
|
||||||
|
ccc_tgt_payload.data_len = 0;
|
||||||
|
|
||||||
|
memset(&ccc_payload, 0, sizeof(ccc_payload));
|
||||||
|
ccc_payload.ccc.id = I3C_CCC_RSTDAA_DC;
|
||||||
|
ccc_payload.targets.payloads = &ccc_tgt_payload;
|
||||||
|
ccc_payload.targets.num_targets = 1;
|
||||||
|
|
||||||
|
return i3c_do_ccc(target->bus, &ccc_payload);
|
||||||
|
}
|
||||||
|
|
||||||
int i3c_ccc_do_rstdaa_all(const struct device *controller)
|
int i3c_ccc_do_rstdaa_all(const struct device *controller)
|
||||||
{
|
{
|
||||||
struct i3c_ccc_payload ccc_payload;
|
struct i3c_ccc_payload ccc_payload;
|
||||||
|
|
|
@ -179,6 +179,14 @@ extern "C" {
|
||||||
*/
|
*/
|
||||||
#define I3C_CCC_VENDOR(broadcast, id) ((id) + ((broadcast) ? 0x61U : 0xE0U))
|
#define I3C_CCC_VENDOR(broadcast, id) ((id) + ((broadcast) ? 0x61U : 0xE0U))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset Dynamic Address (Direct)
|
||||||
|
*
|
||||||
|
* @note This should not be used by devices that support I3C v1.0 and this
|
||||||
|
* shall not be used for devices that support I3C v1.1 or later.
|
||||||
|
*/
|
||||||
|
#define I3C_CCC_RSTDAA_DC 0x86U
|
||||||
|
|
||||||
/** Set Dynamic Address from Static Address (Direct) */
|
/** Set Dynamic Address from Static Address (Direct) */
|
||||||
#define I3C_CCC_SETDASA 0x87U
|
#define I3C_CCC_SETDASA 0x87U
|
||||||
|
|
||||||
|
@ -1502,6 +1510,21 @@ static inline int i3c_ccc_do_rstact_fmt3(const struct i3c_device_desc *target,
|
||||||
return i3c_ccc_do_rstact(target, action, true, data);
|
return i3c_ccc_do_rstact(target, action, true, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Reset dynamic addresses for a targets.
|
||||||
|
*
|
||||||
|
* Helper function to reset a dynamic addresses of a targets.
|
||||||
|
*
|
||||||
|
* @note This should not be used by devices that support I3C v1.0 and this
|
||||||
|
* shall not be used for devices that support I3C v1.1 or later.
|
||||||
|
*
|
||||||
|
* @param[in] target Pointer to the target device descriptor where
|
||||||
|
* the device is configured with a dynamic address.
|
||||||
|
*
|
||||||
|
* @return @see i3c_do_ccc
|
||||||
|
*/
|
||||||
|
int i3c_ccc_do_rstdaa(struct i3c_device_desc *target);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Broadcast RSTDAA to reset dynamic addresses for all targets.
|
* @brief Broadcast RSTDAA to reset dynamic addresses for all targets.
|
||||||
*
|
*
|
||||||
|
@ -1538,7 +1561,7 @@ int i3c_ccc_do_setdasa(const struct i3c_device_desc *target,
|
||||||
* Note this does not update @p target with the new dynamic address.
|
* Note this does not update @p target with the new dynamic address.
|
||||||
*
|
*
|
||||||
* @param[in] target Pointer to the target device descriptor where
|
* @param[in] target Pointer to the target device descriptor where
|
||||||
* the device is configured with a static address.
|
* the device is configured with a dynamic address.
|
||||||
* @param[in] new_da Struct of the Dynamic address
|
* @param[in] new_da Struct of the Dynamic address
|
||||||
*
|
*
|
||||||
* @return @see i3c_do_ccc
|
* @return @see i3c_do_ccc
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue