@@ -130,6 +130,7 @@ enum I2C_REGS_OFFSET {
130
130
OFFSET_HS ,
131
131
OFFSET_SOFTRESET ,
132
132
OFFSET_DCM_EN ,
133
+ OFFSET_MULTI_DMA ,
133
134
OFFSET_PATH_DIR ,
134
135
OFFSET_DEBUGSTAT ,
135
136
OFFSET_DEBUGCTRL ,
@@ -197,6 +198,7 @@ static const u16 mt_i2c_regs_v2[] = {
197
198
[OFFSET_TRANSFER_LEN_AUX ] = 0x44 ,
198
199
[OFFSET_CLOCK_DIV ] = 0x48 ,
199
200
[OFFSET_SOFTRESET ] = 0x50 ,
201
+ [OFFSET_MULTI_DMA ] = 0x8c ,
200
202
[OFFSET_SCL_MIS_COMP_POINT ] = 0x90 ,
201
203
[OFFSET_DEBUGSTAT ] = 0xe4 ,
202
204
[OFFSET_DEBUGCTRL ] = 0xe8 ,
@@ -845,6 +847,57 @@ static int mtk_i2c_set_speed(struct mtk_i2c *i2c, unsigned int parent_clk)
845
847
return 0 ;
846
848
}
847
849
850
+ static void i2c_dump_register (struct mtk_i2c * i2c )
851
+ {
852
+ dev_dbg (i2c -> dev , "SLAVE_ADDR: 0x%x, INTR_MASK: 0x%x\n" ,
853
+ mtk_i2c_readw (i2c , OFFSET_SLAVE_ADDR ),
854
+ mtk_i2c_readw (i2c , OFFSET_INTR_MASK ));
855
+ dev_dbg (i2c -> dev , "INTR_STAT: 0x%x, CONTROL: 0x%x\n" ,
856
+ mtk_i2c_readw (i2c , OFFSET_INTR_STAT ),
857
+ mtk_i2c_readw (i2c , OFFSET_CONTROL ));
858
+ dev_dbg (i2c -> dev , "TRANSFER_LEN: 0x%x, TRANSAC_LEN: 0x%x\n" ,
859
+ mtk_i2c_readw (i2c , OFFSET_TRANSFER_LEN ),
860
+ mtk_i2c_readw (i2c , OFFSET_TRANSAC_LEN ));
861
+ dev_dbg (i2c -> dev , "DELAY_LEN: 0x%x, HTIMING: 0x%x\n" ,
862
+ mtk_i2c_readw (i2c , OFFSET_DELAY_LEN ),
863
+ mtk_i2c_readw (i2c , OFFSET_TIMING ));
864
+ dev_dbg (i2c -> dev , "START: 0x%x, EXT_CONF: 0x%x\n" ,
865
+ mtk_i2c_readw (i2c , OFFSET_START ),
866
+ mtk_i2c_readw (i2c , OFFSET_EXT_CONF ));
867
+ dev_dbg (i2c -> dev , "HS: 0x%x, IO_CONFIG: 0x%x\n" ,
868
+ mtk_i2c_readw (i2c , OFFSET_HS ),
869
+ mtk_i2c_readw (i2c , OFFSET_IO_CONFIG ));
870
+ dev_dbg (i2c -> dev , "DCM_EN: 0x%x, TRANSFER_LEN_AUX: 0x%x\n" ,
871
+ mtk_i2c_readw (i2c , OFFSET_DCM_EN ),
872
+ mtk_i2c_readw (i2c , OFFSET_TRANSFER_LEN_AUX ));
873
+ dev_dbg (i2c -> dev , "CLOCK_DIV: 0x%x, FIFO_STAT: 0x%x\n" ,
874
+ mtk_i2c_readw (i2c , OFFSET_CLOCK_DIV ),
875
+ mtk_i2c_readw (i2c , OFFSET_FIFO_STAT ));
876
+ dev_dbg (i2c -> dev , "DEBUGCTRL : 0x%x, DEBUGSTAT: 0x%x\n" ,
877
+ mtk_i2c_readw (i2c , OFFSET_DEBUGCTRL ),
878
+ mtk_i2c_readw (i2c , OFFSET_DEBUGSTAT ));
879
+ if (i2c -> dev_comp -> regs == mt_i2c_regs_v2 ) {
880
+ dev_dbg (i2c -> dev , "LTIMING: 0x%x, MULTI_DMA: 0x%x\n" ,
881
+ mtk_i2c_readw (i2c , OFFSET_LTIMING ),
882
+ mtk_i2c_readw (i2c , OFFSET_MULTI_DMA ));
883
+ }
884
+ dev_dbg (i2c -> dev , "\nDMA_INT_FLAG: 0x%x, DMA_INT_EN: 0x%x\n" ,
885
+ readl (i2c -> pdmabase + OFFSET_INT_FLAG ),
886
+ readl (i2c -> pdmabase + OFFSET_INT_EN ));
887
+ dev_dbg (i2c -> dev , "DMA_EN: 0x%x, DMA_CON: 0x%x\n" ,
888
+ readl (i2c -> pdmabase + OFFSET_EN ),
889
+ readl (i2c -> pdmabase + OFFSET_CON ));
890
+ dev_dbg (i2c -> dev , "DMA_TX_MEM_ADDR: 0x%x, DMA_RX_MEM_ADDR: 0x%x\n" ,
891
+ readl (i2c -> pdmabase + OFFSET_TX_MEM_ADDR ),
892
+ readl (i2c -> pdmabase + OFFSET_RX_MEM_ADDR ));
893
+ dev_dbg (i2c -> dev , "DMA_TX_LEN: 0x%x, DMA_RX_LEN: 0x%x\n" ,
894
+ readl (i2c -> pdmabase + OFFSET_TX_LEN ),
895
+ readl (i2c -> pdmabase + OFFSET_RX_LEN ));
896
+ dev_dbg (i2c -> dev , "DMA_TX_4G_MODE: 0x%x, DMA_RX_4G_MODE: 0x%x" ,
897
+ readl (i2c -> pdmabase + OFFSET_TX_4G_MODE ),
898
+ readl (i2c -> pdmabase + OFFSET_RX_4G_MODE ));
899
+ }
900
+
848
901
static int mtk_i2c_do_transfer (struct mtk_i2c * i2c , struct i2c_msg * msgs ,
849
902
int num , int left_num )
850
903
{
@@ -1075,6 +1128,7 @@ static int mtk_i2c_do_transfer(struct mtk_i2c *i2c, struct i2c_msg *msgs,
1075
1128
1076
1129
if (ret == 0 ) {
1077
1130
dev_dbg (i2c -> dev , "addr: %x, transfer timeout\n" , msgs -> addr );
1131
+ i2c_dump_register (i2c );
1078
1132
mtk_i2c_init_hw (i2c );
1079
1133
return - ETIMEDOUT ;
1080
1134
}
0 commit comments