Skip to content

Commit c4e3d8c

Browse files
Qii Wanggregkh
authored andcommitted
i2c: mediatek: Fix send master code at more than 1MHz
commit 63ce8e3 upstream. There are some omissions in the previous patch about replacing I2C_MAX_FAST_MODE__FREQ with I2C_MAX_FAST_MODE_PLUS_FREQ and need to fix it. Fixes: b44658e("i2c: mediatek: Send i2c master code at more than 1MHz") Signed-off-by: Qii Wang <qii.wang@mediatek.com> Signed-off-by: Wolfram Sang <wsa@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 667627f commit c4e3d8c

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

‎drivers/i2c/busses/i2c-mt65xx.c‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ static const struct i2c_spec_values *mtk_i2c_get_spec(unsigned int speed)
564564

565565
static int mtk_i2c_max_step_cnt(unsigned int target_speed)
566566
{
567-
if (target_speed > I2C_MAX_FAST_MODE_FREQ)
567+
if (target_speed > I2C_MAX_FAST_MODE_PLUS_FREQ)
568568
return MAX_HS_STEP_CNT_DIV;
569569
else
570570
return MAX_STEP_CNT_DIV;
@@ -635,7 +635,7 @@ static int mtk_i2c_check_ac_timing(struct mtk_i2c *i2c,
635635
if (sda_min > sda_max)
636636
return -3;
637637

638-
if (check_speed > I2C_MAX_FAST_MODE_FREQ) {
638+
if (check_speed > I2C_MAX_FAST_MODE_PLUS_FREQ) {
639639
if (i2c->dev_comp->ltiming_adjust) {
640640
i2c->ac_timing.hs = I2C_TIME_DEFAULT_VALUE |
641641
(sample_cnt << 12) | (high_cnt << 8);
@@ -850,7 +850,7 @@ static int mtk_i2c_do_transfer(struct mtk_i2c *i2c, struct i2c_msg *msgs,
850850

851851
control_reg = mtk_i2c_readw(i2c, OFFSET_CONTROL) &
852852
~(I2C_CONTROL_DIR_CHANGE | I2C_CONTROL_RS);
853-
if ((i2c->speed_hz > I2C_MAX_FAST_MODE_FREQ) || (left_num >= 1))
853+
if ((i2c->speed_hz > I2C_MAX_FAST_MODE_PLUS_FREQ) || (left_num >= 1))
854854
control_reg |= I2C_CONTROL_RS;
855855

856856
if (i2c->op == I2C_MASTER_WRRD)
@@ -1067,7 +1067,8 @@ static int mtk_i2c_transfer(struct i2c_adapter *adap,
10671067
}
10681068
}
10691069

1070-
if (i2c->auto_restart && num >= 2 && i2c->speed_hz > I2C_MAX_FAST_MODE_FREQ)
1070+
if (i2c->auto_restart && num >= 2 &&
1071+
i2c->speed_hz > I2C_MAX_FAST_MODE_PLUS_FREQ)
10711072
/* ignore the first restart irq after the master code,
10721073
* otherwise the first transfer will be discarded.
10731074
*/

0 commit comments

Comments
 (0)