lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VeBuR4fkVk0z=+d7EonHz0h=4=eRj3Wfe8R_8T=eyHaeA@mail.gmail.com>
Date:   Mon, 14 Sep 2020 15:48:56 +0300
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     qii.wang@...iatek.com
Cc:     Wolfram Sang <wsa@...-dreams.de>,
        linux-i2c <linux-i2c@...r.kernel.org>,
        devicetree <devicetree@...r.kernel.org>,
        linux-arm Mailing List <linux-arm-kernel@...ts.infradead.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        "moderated list:ARM/Mediatek SoC support" 
        <linux-mediatek@...ts.infradead.org>,
        srv_heupstream <srv_heupstream@...iatek.com>,
        Leilk Liu <leilk.liu@...iatek.com>
Subject: Re: [PATCH] i2c: mediatek: Fix generic definitions for bus frequencies

On Sat, Sep 12, 2020 at 9:02 AM <qii.wang@...iatek.com> wrote:
>
> From: Qii Wang <qii.wang@...iatek.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.
>
> Signed-off-by: Qii Wang <qii.wang@...iatek.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;

Thanks for fixing this. Indeed, somehow I messed these up.

>
>         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) {

But this one is not related. Original code used to have

#define MAX_FS_MODE_SPEED              400000

       if (target_speed > MAX_FS_MODE_SPEED) {

And this change doesn't fix the above mentioned problem.

So, please split into two separate changes.

>                         /* Set master code speed register */
>                         ret = mtk_i2c_calculate_speed(i2c, clk_src,
>                                                       I2C_MAX_FAST_MODE_FREQ,
> --
> 1.9.1



-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ