drivers/i3c: avoid return error when i3c_master_register without i3c/i2c device

1. if i3c_mater_register without i3c/i2c device, rstdaa/clearevents/do_daa could be failed
2. board code/driver code need to actively i3c_master_do_daa when device power on.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
This commit is contained in:
dongjiuzhu1 2024-06-17 21:16:47 +08:00 committed by Xiang Xiao
parent 694750e8af
commit 4960f290c8
1 changed files with 6 additions and 6 deletions

View File

@ -1032,7 +1032,8 @@ static int i3c_master_bus_init(FAR struct i3c_master_controller *master)
ret = i3c_master_rstdaa_locked(master, I3C_BROADCAST_ADDR); ret = i3c_master_rstdaa_locked(master, I3C_BROADCAST_ADDR);
if (ret && ret != I3C_ERROR_M2) if (ret && ret != I3C_ERROR_M2)
{ {
goto err_bus_cleanup; i3cerr("master_rstdaa_locked() failed:%d (no device or timeout)\n",
ret);
} }
/* Disable all slave events before starting DAA. */ /* Disable all slave events before starting DAA. */
@ -1042,7 +1043,8 @@ static int i3c_master_bus_init(FAR struct i3c_master_controller *master)
I3C_CCC_EVENT_HJ); I3C_CCC_EVENT_HJ);
if (ret && ret != I3C_ERROR_M2) if (ret && ret != I3C_ERROR_M2)
{ {
goto err_bus_cleanup; i3cerr("master_disec_locked() failed:%d (no device or timeout)\n",
ret);
} }
/* Reserve init_dyn_addr first, and then try to pre-assign dynamic /* Reserve init_dyn_addr first, and then try to pre-assign dynamic
@ -1055,14 +1057,12 @@ static int i3c_master_bus_init(FAR struct i3c_master_controller *master)
ret = i3c_master_do_daa(master); ret = i3c_master_do_daa(master);
if (ret) if (ret)
{ {
goto err_rstdaa; i3c_master_rstdaa_locked(master, I3C_BROADCAST_ADDR);
i3cerr("master_do_daa failed:%d (no device)\n", ret);
} }
return 0; return 0;
err_rstdaa:
i3c_master_rstdaa_locked(master, I3C_BROADCAST_ADDR);
err_bus_cleanup: err_bus_cleanup:
if (master->ops->bus_cleanup) if (master->ops->bus_cleanup)
{ {