[PATCH] i2c: mediatek: Fix generic definitions for bus frequencies

Yingjoe Chen yingjoe.chen at mediatek.com
Sun Sep 13 11:15:56 EDT 2020


On Sat, 2020-09-12 at 13:57 +0800, qii.wang at mediatek.com wrote:
> From: Qii Wang <qii.wang at mediatek.com>
> 
> The master code needs to being sent when the speed is more than
> I2C_MAX_FAST_MODE_PLUS_FREQ instead of
> I2C_MAX_HIGH_SPEED_MODE_FREQ. Fix it.

This was introduced by "i2c: drivers: Use generic definitions for bus
frequencies". You should have
Fixes: 90224e6468e1 ("i2c: drivers: Use generic definitions for bus
frequencies")

You can have my reviewed by after you add fixes.
Reviewed-by: Yingjoe Chen <yingjoe.chen at mediatek.com>

Joe.C

> 
> Signed-off-by: Qii Wang <qii.wang at mediatek.com>
> ---
>  drivers/i2c/busses/i2c-mt65xx.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-mt65xx.c b/drivers/i2c/busses/i2c-mt65xx.c
> index efc1404..0cbdfbe 100644
> --- a/drivers/i2c/busses/i2c-mt65xx.c
> +++ b/drivers/i2c/busses/i2c-mt65xx.c
> @@ -681,8 +681,8 @@ static int mtk_i2c_calculate_speed(struct mtk_i2c *i2c, unsigned int clk_src,
>  	unsigned int cnt_mul;
>  	int ret = -EINVAL;
>  
> -	if (target_speed > I2C_MAX_FAST_MODE_PLUS_FREQ)
> -		target_speed = I2C_MAX_FAST_MODE_PLUS_FREQ;
> +	if (target_speed > I2C_MAX_HIGH_SPEED_MODE_FREQ)
> +		target_speed = I2C_MAX_HIGH_SPEED_MODE_FREQ;
>  
>  	max_step_cnt = mtk_i2c_max_step_cnt(target_speed);
>  	base_step_cnt = max_step_cnt;
> @@ -759,7 +759,7 @@ static int mtk_i2c_set_speed(struct mtk_i2c *i2c, unsigned int parent_clk)
>  	for (clk_div = 1; clk_div <= max_clk_div; clk_div++) {
>  		clk_src = parent_clk / clk_div;
>  
> -		if (target_speed > I2C_MAX_FAST_MODE_FREQ) {
> +		if (target_speed > I2C_MAX_FAST_MODE_PLUS_FREQ) {
>  			/* Set master code speed register */
>  			ret = mtk_i2c_calculate_speed(i2c, clk_src,
>  						      I2C_MAX_FAST_MODE_FREQ,



More information about the linux-arm-kernel mailing list