Skip to content

Commit aa50860

Browse files
Shreehari-AlifSemicfriedt
authored andcommitted
drivers: i3c: add open-drain speed support
Add SHELL support for configuring I3C open-drain speed modes. Implementation: - Include open-drain timing configuration inside cmd_i3c_speed function. Signed-off-by: Shreehari HK <[email protected]>
1 parent c81b029 commit aa50860

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

drivers/i3c/i3c_shell.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ static int cmd_i3c_info(const struct shell *sh, size_t argc, char **argv)
297297
return 0;
298298
}
299299

300-
/* i3c speed <device> <speed> */
300+
/* i3c speed <device> <speed> [<od_min high_ns>] [<od_min low_ns>] */
301301
static int cmd_i3c_speed(const struct shell *sh, size_t argc, char **argv)
302302
{
303303
const struct device *dev;
@@ -321,6 +321,12 @@ static int cmd_i3c_speed(const struct shell *sh, size_t argc, char **argv)
321321

322322
config.scl.i3c = speed;
323323

324+
if (argc == 5) {
325+
/* This sets open-drain SCL high and low periods */
326+
config.scl_od_min.high_ns = strtol(argv[ARGV_DEV + 2], NULL, 10);
327+
config.scl_od_min.low_ns = strtol(argv[ARGV_DEV + 3], NULL, 10);
328+
}
329+
324330
ret = i3c_configure(dev, I3C_CONFIG_CONTROLLER, &config);
325331
if (ret != 0) {
326332
shell_error(sh, "I3C: Failed to configure device");
@@ -2390,8 +2396,8 @@ SHELL_STATIC_SUBCMD_SET_CREATE(
23902396
cmd_i3c_info, 2, 1),
23912397
SHELL_CMD_ARG(speed, &dsub_i3c_device_name,
23922398
"Set I3C device speed\n"
2393-
"Usage: speed <device> <speed>",
2394-
cmd_i3c_speed, 3, 0),
2399+
"Usage: speed <device> <speed> [<od_min high_ns>] [<od_min low_ns>]",
2400+
cmd_i3c_speed, 3, 2),
23952401
SHELL_CMD_ARG(recover, &dsub_i3c_device_name,
23962402
"Recover I3C bus\n"
23972403
"Usage: recover <device>",

0 commit comments

Comments
 (0)