Skip to content

Commit 173fcb2

Browse files
wangxiaoningnxpalexandrebelloni
authored andcommitted
i3c: master: svc: set ODSTOP to let I2C device see the STOP signal
If using I2C/I3C mixed mode, need to set ODSTOP. Otherwise, the I2C devices cannot see the stop signal. It may cause message sending errors. Signed-off-by: Clark Wang <[email protected]> Reviewed-by: Miquel Raynal <[email protected]> Reviewed-by: Jun Li <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent d5e5125 commit 173fcb2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/i3c/master/svc-i3c-master.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ static int svc_i3c_master_bus_init(struct i3c_master_controller *m)
477477
struct i3c_device_info info = {};
478478
unsigned long fclk_rate, fclk_period_ns;
479479
unsigned int high_period_ns, od_low_period_ns;
480-
u32 ppbaud, pplow, odhpp, odbaud, i2cbaud, reg;
480+
u32 ppbaud, pplow, odhpp, odbaud, odstop, i2cbaud, reg;
481481
int ret;
482482

483483
/* Timings derivation */
@@ -507,6 +507,7 @@ static int svc_i3c_master_bus_init(struct i3c_master_controller *m)
507507
switch (bus->mode) {
508508
case I3C_BUS_MODE_PURE:
509509
i2cbaud = 0;
510+
odstop = 0;
510511
break;
511512
case I3C_BUS_MODE_MIXED_FAST:
512513
case I3C_BUS_MODE_MIXED_LIMITED:
@@ -515,13 +516,15 @@ static int svc_i3c_master_bus_init(struct i3c_master_controller *m)
515516
* between the high and low period does not really matter.
516517
*/
517518
i2cbaud = DIV_ROUND_UP(1000, od_low_period_ns) - 2;
519+
odstop = 1;
518520
break;
519521
case I3C_BUS_MODE_MIXED_SLOW:
520522
/*
521523
* Using I2C Fm mode, target is 0.4MHz/2500ns, with the same
522524
* constraints as the FM+ mode.
523525
*/
524526
i2cbaud = DIV_ROUND_UP(2500, od_low_period_ns) - 2;
527+
odstop = 1;
525528
break;
526529
default:
527530
return -EINVAL;
@@ -530,7 +533,7 @@ static int svc_i3c_master_bus_init(struct i3c_master_controller *m)
530533
reg = SVC_I3C_MCONFIG_MASTER_EN |
531534
SVC_I3C_MCONFIG_DISTO(0) |
532535
SVC_I3C_MCONFIG_HKEEP(0) |
533-
SVC_I3C_MCONFIG_ODSTOP(0) |
536+
SVC_I3C_MCONFIG_ODSTOP(odstop) |
534537
SVC_I3C_MCONFIG_PPBAUD(ppbaud) |
535538
SVC_I3C_MCONFIG_PPLOW(pplow) |
536539
SVC_I3C_MCONFIG_ODBAUD(odbaud) |

0 commit comments

Comments
 (0)