Skip to content

Commit 061dd21

Browse files
billy-tsaialexandrebelloni
authored andcommitted
i3c/master: cmd_v1: Fix the rule for getting i3c mode
Based on the I3C TCRI specification, the rules for determining the I3C mode are as follows: I3C SCL rate > 8MHz: use SDR0, as SDR1 has a maximum data rate of 8MHz I3C SCL rate > 6MHz: use SDR1, as SDR2 has a maximum data rate of 6MHz I3C SCL rate > 4MHz: use SDR2, as SDR3 has a maximum data rate of 4MHz I3C SCL rate > 2MHz: use SDR3, as SDR4 has a maximum data rate of 2MHz Otherwise, use SDR4 Signed-off-by: Billy Tsai <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
1 parent 133f67b commit 061dd21

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

drivers/i3c/master/mipi-i3c-hci/cmd_v1.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,17 +123,15 @@ static enum hci_cmd_mode get_i3c_mode(struct i3c_hci *hci)
123123
{
124124
struct i3c_bus *bus = i3c_master_get_bus(&hci->master);
125125

126-
if (bus->scl_rate.i3c >= 12500000)
127-
return MODE_I3C_SDR0;
128126
if (bus->scl_rate.i3c > 8000000)
129-
return MODE_I3C_SDR1;
127+
return MODE_I3C_SDR0;
130128
if (bus->scl_rate.i3c > 6000000)
131-
return MODE_I3C_SDR2;
129+
return MODE_I3C_SDR1;
132130
if (bus->scl_rate.i3c > 4000000)
133-
return MODE_I3C_SDR3;
131+
return MODE_I3C_SDR2;
134132
if (bus->scl_rate.i3c > 2000000)
135-
return MODE_I3C_SDR4;
136-
return MODE_I3C_Fm_FmP;
133+
return MODE_I3C_SDR3;
134+
return MODE_I3C_SDR4;
137135
}
138136

139137
static enum hci_cmd_mode get_i2c_mode(struct i3c_hci *hci)

0 commit comments

Comments
 (0)