Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1533421

Re: [PATCH v3 2/5] i2c: Add STM32F4 I2C driver

From Wolfram Sang <wsa-dev@sang-engineering.com>
Newsgroups linux.kernel
Subject Re: [PATCH v3 2/5] i2c: Add STM32F4 I2C driver
Date 2016-11-30 17:30 +0100
Message-ID <sJfVD-8ry-13@gated-at.bofh.it> (permalink)
References <rMaff-27F-13@gated-at.bofh.it> <rMaff-27F-27@gated-at.bofh.it> <rXCKR-2yo-15@gated-at.bofh.it> <sJ9ZT-4JS-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

Hi,

> I was too busy in another project but now I am ready to complete the
> upstream of the STM32F4 I2C driver.

Nice.

> >> +static void stm32f4_i2c_set_periph_clk_freq(struct stm32f4_i2c_dev *i2c_dev)
> >> +{
> >> +     u32 clk_rate, cr2, freq;
> >> +
> >> +     cr2 = readl_relaxed(i2c_dev->base + STM32F4_I2C_CR2);
> >> +     cr2 &= ~STM32F4_I2C_CR2_FREQ_MASK;
> >> +
> >> +     clk_rate = clk_get_rate(i2c_dev->clk);
> >> +     freq = clk_rate / MHZ_TO_HZ;
> >> +
> >> +     if (freq > STM32F4_I2C_MAX_FREQ)
> >> +             freq = STM32F4_I2C_MAX_FREQ;
> >> +     if (freq < STM32F4_I2C_MIN_FREQ)
> >> +             freq = STM32F4_I2C_MIN_FREQ;
> >
> > clamp() to enforce the range?
> Sorry but what do you mean by "clamp()" ?

The kernel has a clamp() function which would fit this purpose, I think.

Regards,

   Wolfram

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH v3 2/5] i2c: Add STM32F4 I2C driver "M'boumba Cedric Madianga" <cedric.madianga@gmail.com> - 2016-11-30 11:10 +0100
  Re: [PATCH v3 2/5] i2c: Add STM32F4 I2C driver Wolfram Sang <wsa-dev@sang-engineering.com> - 2016-11-30 17:30 +0100
    Re: [PATCH v3 2/5] i2c: Add STM32F4 I2C driver "M'boumba Cedric Madianga" <cedric.madianga@gmail.com> - 2016-11-30 18:10 +0100

csiph-web