Skip to content

Commit 3bce770

Browse files
Kewei Xuwsakernel
authored andcommitted
i2c: mediatek: Add OFFSET_EXT_CONF setting back
In the commit be5ce0e ("i2c: mediatek: Add i2c ac-timing adjust support"), we miss setting OFFSET_EXT_CONF register if i2c->dev_comp->timing_adjust is false, now add it back. Fixes: be5ce0e ("i2c: mediatek: Add i2c ac-timing adjust support") Signed-off-by: Kewei Xu <[email protected]> Reviewed-by: Qii Wang <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
1 parent 6558b64 commit 3bce770

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

drivers/i2c/busses/i2c-mt65xx.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141
#define I2C_HANDSHAKE_RST 0x0020
4242
#define I2C_FIFO_ADDR_CLR 0x0001
4343
#define I2C_DELAY_LEN 0x0002
44+
#define I2C_ST_START_CON 0x8001
45+
#define I2C_FS_START_CON 0x1800
4446
#define I2C_TIME_CLR_VALUE 0x0000
4547
#define I2C_TIME_DEFAULT_VALUE 0x0003
4648
#define I2C_WRRD_TRANAC_VALUE 0x0002
@@ -480,6 +482,7 @@ static void mtk_i2c_init_hw(struct mtk_i2c *i2c)
480482
{
481483
u16 control_reg;
482484
u16 intr_stat_reg;
485+
u16 ext_conf_val;
483486

484487
mtk_i2c_writew(i2c, I2C_CHN_CLR_FLAG, OFFSET_START);
485488
intr_stat_reg = mtk_i2c_readw(i2c, OFFSET_INTR_STAT);
@@ -518,8 +521,13 @@ static void mtk_i2c_init_hw(struct mtk_i2c *i2c)
518521
if (i2c->dev_comp->ltiming_adjust)
519522
mtk_i2c_writew(i2c, i2c->ltiming_reg, OFFSET_LTIMING);
520523

524+
if (i2c->speed_hz <= I2C_MAX_STANDARD_MODE_FREQ)
525+
ext_conf_val = I2C_ST_START_CON;
526+
else
527+
ext_conf_val = I2C_FS_START_CON;
528+
521529
if (i2c->dev_comp->timing_adjust) {
522-
mtk_i2c_writew(i2c, i2c->ac_timing.ext, OFFSET_EXT_CONF);
530+
ext_conf_val = i2c->ac_timing.ext;
523531
mtk_i2c_writew(i2c, i2c->ac_timing.inter_clk_div,
524532
OFFSET_CLOCK_DIV);
525533
mtk_i2c_writew(i2c, I2C_SCL_MIS_COMP_VALUE,
@@ -544,6 +552,7 @@ static void mtk_i2c_init_hw(struct mtk_i2c *i2c)
544552
OFFSET_HS_STA_STO_AC_TIMING);
545553
}
546554
}
555+
mtk_i2c_writew(i2c, ext_conf_val, OFFSET_EXT_CONF);
547556

548557
/* If use i2c pin from PMIC mt6397 side, need set PATH_DIR first */
549558
if (i2c->have_pmic)

0 commit comments

Comments
 (0)