Commit 156e6488 authored by Manikanta Guntupalli's avatar Manikanta Guntupalli Committed by Benjamin Cabé
Browse files

drivers: i3c: Correct initialization order

The current initialization sequence enables the I3C controller before
setting the controller information, which can result in improper setup
and cause the controller to not function as expected.

Fix the initialization order by ensuring that the controller information
is set prior to enabling the controller.

Signed-off-by: default avatarManikanta Guntupalli <manikanta.guntupalli@amd.com>
Signed-off-by: default avatarBalanakakamal V <balanakakamal.v@amd.com>
parent 9ac88999
Loading
Loading
Loading
Loading
+6 −3
Changes for drivers/i3c/i3c_dw.c: 6 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -2373,14 +2373,17 @@ static int dw_i3c_init(const struct device *dev)
	if (ret != 0) {
		return ret;
	}
#endif /* CONFIG_I3C_CONTROLLER */
	dw_i3c_enable_controller(config, true);
#ifdef CONFIG_I3C_CONTROLLER

	if (!(ctrl_config->is_secondary)) {
		ret = set_controller_info(dev);
		if (ret) {
			return ret;
		}
	}
#endif /* CONFIG_I3C_CONTROLLER */
	dw_i3c_enable_controller(config, true);
#ifdef CONFIG_I3C_CONTROLLER
	if (!(ctrl_config->is_secondary)) {
		/* Perform bus initialization - skip if no I3C devices are known. */
		if (config->common.dev_list.num_i3c > 0) {
			ret = i3c_bus_init(dev, &config->common.dev_list);