linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: wsa-dev@sang-engineering.com (Wolfram Sang)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 2/5] i2c: Add STM32F4 I2C driver
Date: Wed, 30 Nov 2016 17:23:53 +0100	[thread overview]
Message-ID: <20161130162353.GC1441@katana> (raw)
In-Reply-To: <CAOAejn0BZNH82kY_7UR1EjV7M1G+9jGihGb4-uCs9=XiPHUYxQ@mail.gmail.com>

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20161130/e13dca49/attachment.sig>

  reply	other threads:[~2016-11-30 16:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-20 16:22 [PATCH v3 0/5] Add support for the STM32F4 I2C M'boumba Cedric Madianga
2016-06-20 16:22 ` [PATCH v3 1/5] dt-bindings: Document the STM32 I2C bindings M'boumba Cedric Madianga
2016-06-20 16:22 ` [PATCH v3 2/5] i2c: Add STM32F4 I2C driver M'boumba Cedric Madianga
2016-07-22  7:02   ` Wolfram Sang
2016-11-30  9:26     ` M'boumba Cedric Madianga
2016-11-30 16:23       ` Wolfram Sang [this message]
2016-11-30 17:07         ` M'boumba Cedric Madianga
2016-06-20 16:22 ` [PATCH v3 3/5] ARM: dts: Add I2C1 support for STM32F429 SoC M'boumba Cedric Madianga
2016-06-20 16:22 ` [PATCH v3 4/5] ARM: dts: Add I2C1 support for STM32429 eval board M'boumba Cedric Madianga
2016-06-20 16:22 ` [PATCH v3 5/5] ARM: configs: Add I2C support for STM32 defconfig M'boumba Cedric Madianga
  -- strict thread matches above, loose matches on Subject: below --
2016-06-20 16:20 [PATCH v3 0/5] Add support for the STM32F4 I2C M'boumba Cedric Madianga
2016-06-20 16:20 ` [PATCH v3 2/5] i2c: Add STM32F4 I2C driver M'boumba Cedric Madianga

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161130162353.GC1441@katana \
    --to=wsa-dev@sang-engineering.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).