Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers: i3c: add controller handoff #78361

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
8 changes: 8 additions & 0 deletions drivers/i3c/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ zephyr_library_sources(
i3c_common.c
)

if(CONFIG_I3C_NUM_OF_DESC_MEM_SLABS GREATER 0)
zephyr_library_sources(i3c_mem_slab.c)
endif()

if(CONFIG_I3C_I2C_NUM_OF_DESC_MEM_SLABS GREATER 0)
zephyr_library_sources(i3c_i2c_mem_slab.c)
endif()

zephyr_library_sources_ifdef(
CONFIG_USERSPACE
i3c_handlers.c
Expand Down
16 changes: 16 additions & 0 deletions drivers/i3c/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,22 @@ config I3C_INIT_RSTACT
This determines whether the bus initialization routine
sends a reset action command to I3C targets.

config I3C_NUM_OF_DESC_MEM_SLABS
int "Number of I3C Device Descriptors Mem Slabs"
default 3
help
This is the number of memory slabs allocated from when
there is a device encounted through ENTDAA or DEFTGTS that
is not within known I3C devices.

config I3C_I2C_NUM_OF_DESC_MEM_SLABS
int "Number of I2C Device Descriptors Mem Slabs"
default 3
help
This is the number of memory slabs allocated from when
there is a device encounted through DEFTGTS that is not
within known I2C devices.

comment "Device Drivers"

rsource "Kconfig.nxp"
Expand Down
25 changes: 25 additions & 0 deletions drivers/i3c/i3c_ccc.c
Original file line number Diff line number Diff line change
Expand Up @@ -910,3 +910,28 @@ int i3c_ccc_do_setbuscon(const struct device *controller,

return i3c_do_ccc(controller, &ccc_payload);
}

int i3c_ccc_do_getacccr(const struct i3c_device_desc *target,
struct i3c_ccc_address *handoff_address)
{
struct i3c_ccc_payload ccc_payload;
struct i3c_ccc_target_payload ccc_tgt_payload;
int ret;

__ASSERT_NO_MSG(target != NULL);
__ASSERT_NO_MSG(handoff_address != NULL);

ccc_tgt_payload.addr = target->dynamic_addr;
ccc_tgt_payload.rnw = 1;
ccc_tgt_payload.data = &handoff_address->addr;
ccc_tgt_payload.data_len = 1;

memset(&ccc_payload, 0, sizeof(ccc_payload));
ccc_payload.ccc.id = I3C_CCC_GETACCCR;
ccc_payload.targets.payloads = &ccc_tgt_payload;
ccc_payload.targets.num_targets = 1;

ret = i3c_do_ccc(target->bus, &ccc_payload);

return ret;
}
Loading
Loading