Re: [PATCH v1 36/40] i2c: synquacer: Use generic definitions for bus frequencies

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 24 Feb 2020 at 16:15, Andy Shevchenko
<andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
>
> Since we have generic definitions for bus frequencies, let's use them.
>
> Cc: Ard Biesheuvel <ardb@xxxxxxxxxx>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>

Acked-by: Ard Biesheuvel <ardb@xxxxxxxxxx>

> ---
>  drivers/i2c/busses/i2c-synquacer.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-synquacer.c b/drivers/i2c/busses/i2c-synquacer.c
> index 86026798b4f7..ccd2ed4fa2f1 100644
> --- a/drivers/i2c/busses/i2c-synquacer.c
> +++ b/drivers/i2c/busses/i2c-synquacer.c
> @@ -67,10 +67,10 @@
>
>  /* STANDARD MODE frequency */
>  #define SYNQUACER_I2C_CLK_MASTER_STD(rate)                     \
> -       DIV_ROUND_UP(DIV_ROUND_UP((rate), 100000) - 2, 2)
> +       DIV_ROUND_UP(DIV_ROUND_UP((rate), I2C_STANDARD_MODE_FREQ) - 2, 2)
>  /* FAST MODE frequency */
>  #define SYNQUACER_I2C_CLK_MASTER_FAST(rate)                    \
> -       DIV_ROUND_UP((DIV_ROUND_UP((rate), 400000) - 2) * 2, 3)
> +       DIV_ROUND_UP((DIV_ROUND_UP((rate), I2C_FAST_MODE_FREQ) - 2) * 2, 3)
>
>  /* (clkrate <= 18000000) */
>  /* calculate the value of CS bits in CCR register on standard mode */
> @@ -111,11 +111,11 @@
>                                         & SYNQUACER_I2C_CSR_CS_MASK)
>
>  /* min I2C clock frequency 14M */
> -#define SYNQUACER_I2C_MIN_CLK_RATE     (14 * 1000000)
> +#define SYNQUACER_I2C_MIN_CLK_RATE     (14 * HZ_PER_MHZ)
>  /* max I2C clock frequency 200M */
> -#define SYNQUACER_I2C_MAX_CLK_RATE     (200 * 1000000)
> +#define SYNQUACER_I2C_MAX_CLK_RATE     (200 * HZ_PER_MHZ)
>  /* I2C clock frequency 18M */
> -#define SYNQUACER_I2C_CLK_RATE_18M     (18 * 1000000)
> +#define SYNQUACER_I2C_CLK_RATE_18M     (18 * HZ_PER_MHZ)
>
>  #define SYNQUACER_I2C_SPEED_FM         400     // Fast Mode
>  #define SYNQUACER_I2C_SPEED_SM         100     // Standard Mode
> @@ -602,7 +602,7 @@ static int synquacer_i2c_probe(struct platform_device *pdev)
>         i2c->adapter.nr = pdev->id;
>         init_completion(&i2c->completion);
>
> -       if (bus_speed < 400000)
> +       if (bus_speed < I2C_FAST_MODE_FREQ)
>                 i2c->speed_khz = SYNQUACER_I2C_SPEED_SM;
>         else
>                 i2c->speed_khz = SYNQUACER_I2C_SPEED_FM;
> --
> 2.25.0
>



[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux