@@ -543,18 +543,22 @@ static int dw_i3c_clk_cfg(struct dw_i3c_master *master)
543
543
544
544
scl_timing = SCL_I3C_TIMING_HCNT (hcnt ) | SCL_I3C_TIMING_LCNT (lcnt );
545
545
writel (scl_timing , master -> regs + SCL_I3C_PP_TIMING );
546
+ master -> i3c_pp_timing = scl_timing ;
546
547
547
548
/*
548
549
* In pure i3c mode, MST_FREE represents tCAS. In shared mode, this
549
550
* will be set up by dw_i2c_clk_cfg as tLOW.
550
551
*/
551
- if (master -> base .bus .mode == I3C_BUS_MODE_PURE )
552
+ if (master -> base .bus .mode == I3C_BUS_MODE_PURE ) {
552
553
writel (BUS_I3C_MST_FREE (lcnt ), master -> regs + BUS_FREE_TIMING );
554
+ master -> bus_free_timing = BUS_I3C_MST_FREE (lcnt );
555
+ }
553
556
554
557
lcnt = max_t (u8 ,
555
558
DIV_ROUND_UP (I3C_BUS_TLOW_OD_MIN_NS , core_period ), lcnt );
556
559
scl_timing = SCL_I3C_TIMING_HCNT (hcnt ) | SCL_I3C_TIMING_LCNT (lcnt );
557
560
writel (scl_timing , master -> regs + SCL_I3C_OD_TIMING );
561
+ master -> i3c_od_timing = scl_timing ;
558
562
559
563
lcnt = DIV_ROUND_UP (core_rate , I3C_BUS_SDR1_SCL_RATE ) - hcnt ;
560
564
scl_timing = SCL_EXT_LCNT_1 (lcnt );
@@ -565,6 +569,7 @@ static int dw_i3c_clk_cfg(struct dw_i3c_master *master)
565
569
lcnt = DIV_ROUND_UP (core_rate , I3C_BUS_SDR4_SCL_RATE ) - hcnt ;
566
570
scl_timing |= SCL_EXT_LCNT_4 (lcnt );
567
571
writel (scl_timing , master -> regs + SCL_EXT_LCNT_TIMING );
572
+ master -> ext_lcnt_timing = scl_timing ;
568
573
569
574
return 0 ;
570
575
}
@@ -586,16 +591,21 @@ static int dw_i2c_clk_cfg(struct dw_i3c_master *master)
586
591
scl_timing = SCL_I2C_FMP_TIMING_HCNT (hcnt ) |
587
592
SCL_I2C_FMP_TIMING_LCNT (lcnt );
588
593
writel (scl_timing , master -> regs + SCL_I2C_FMP_TIMING );
594
+ master -> i2c_fmp_timing = scl_timing ;
589
595
590
596
lcnt = DIV_ROUND_UP (I3C_BUS_I2C_FM_TLOW_MIN_NS , core_period );
591
597
hcnt = DIV_ROUND_UP (core_rate , I3C_BUS_I2C_FM_SCL_RATE ) - lcnt ;
592
598
scl_timing = SCL_I2C_FM_TIMING_HCNT (hcnt ) |
593
599
SCL_I2C_FM_TIMING_LCNT (lcnt );
594
600
writel (scl_timing , master -> regs + SCL_I2C_FM_TIMING );
601
+ master -> i2c_fm_timing = scl_timing ;
595
602
596
603
writel (BUS_I3C_MST_FREE (lcnt ), master -> regs + BUS_FREE_TIMING );
604
+ master -> bus_free_timing = BUS_I3C_MST_FREE (lcnt );
605
+
597
606
writel (readl (master -> regs + DEVICE_CTRL ) | DEV_CTRL_I2C_SLAVE_PRESENT ,
598
607
master -> regs + DEVICE_CTRL );
608
+ master -> i2c_slv_prsnt = true;
599
609
600
610
return 0 ;
601
611
}
@@ -650,7 +660,7 @@ static int dw_i3c_master_bus_init(struct i3c_master_controller *m)
650
660
651
661
writel (DEV_ADDR_DYNAMIC_ADDR_VALID | DEV_ADDR_DYNAMIC (ret ),
652
662
master -> regs + DEVICE_ADDR );
653
-
663
+ master -> dev_addr = ret ;
654
664
memset (& info , 0 , sizeof (info ));
655
665
info .dyn_addr = ret ;
656
666
@@ -1077,6 +1087,7 @@ static int dw_i3c_master_attach_i2c_dev(struct i2c_dev_desc *dev)
1077
1087
1078
1088
data -> index = pos ;
1079
1089
master -> devs [pos ].addr = dev -> addr ;
1090
+ master -> devs [pos ].is_i2c_addr = true;
1080
1091
master -> free_pos &= ~BIT (pos );
1081
1092
i2c_dev_set_master_data (dev , data );
1082
1093
0 commit comments