From: Neil Armstrong <narmstrong@baylibre.com>
To: "M'boumba Cedric Madianga" <cedric.madianga@gmail.com>
Cc: Wolfram Sang <wsa@the-dreams.de>,
Rob Herring <robh+dt@kernel.org>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Alexandre Torgue <alexandre.torgue@st.com>,
Linus Walleij <linus.walleij@linaro.org>,
Pierre-Yves MORDRET <pierre-yves.mordret@st.com>,
Russell King <linux@armlinux.org.uk>,
linux-i2c@vger.kernel.org, devicetree@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/5] i2c: i2c-stm32f7: add driver
Date: Fri, 17 Mar 2017 15:53:18 +0100 [thread overview]
Message-ID: <971895d3-2fe6-ecb6-9dc3-ee71193b34ee@baylibre.com> (raw)
In-Reply-To: <CAOAejn0Hs7QOgcrHM2t3NsFQeD9dyvThDK-8iM1Lvb7Qv4fGGQ@mail.gmail.com>
On 03/17/2017 02:52 PM, M'boumba Cedric Madianga wrote:
> Hi,
>
>
>>> +static int stm32f7_i2c_hw_config(struct stm32f7_i2c_dev *i2c_dev)
>>> +{
>>> + struct device_node *of_node = i2c_dev->dev->of_node;
>>> + u32 timing;
>>> + int ret;
>>> +
>>> + ret = of_property_read_u32(of_node, "st,i2c-timing", &timing);
>>> + if (ret) {
>>> + dev_err(i2c_dev->dev, "Error: missing i2c timing property\n");
>>> + return ret;
>>> + }
>>> +
>>> + /* Timing settings */
>>> + writel_relaxed(timing, i2c_dev->base + STM32F7_I2C_TIMINGR);
>>
>> Hi,
>>
>> Using a register value in DT is quite ugly since the requirement to calculate the timings
>> is quite easy, and well documented.
>>
>> I wrote it for Zephyr, you can find it here :
>> https://github.com/zephyrproject-rtos/zephyr/blob/master/drivers/i2c/i2c_stm32lx.c#L31
>
> Thanks for this code. It is very interesting.
> With our formula, I just notice that we don't use any i2c rise time or
> fall time but they have some impacts in i2c timing computation.
> So, the user could not be able to select these values for him use case. Right ?
Sorry I don't understand.
The value you use from the DT and the one calculated from the setup/hold/high/low value
with the algorithm I developed will set the same values.
The main difference is that you won't need the ST tool to calculate these, and even better
you can provide generic binding for whatever APB frequency the I2C peripheral is running
on.
>
>
>>
>> Another point, maybe you should find a better name for the driver, since this I2C IP is share
>> with the STM32Lx also and is not tied to STM32F7.
>
> As far as I know, we don't have any STM32Lx SoC integrated in the
> linux kernel mainline.
> I choose i2c-stm32f7 name as it is the first Soc integrated in the
> linux kernel mainline where this IP could be used.
Having the STM32L4 running mainline won't be hard, maybe useless, but not hard.
My point is that you can somehow consider the STM32F0/F1/F4 I2C IP to be "v1" or "gen1",
and the L0/L4/F6 (and H7 ?) to be "v2" or "gen2" then prepend a generic compatible to
have something like :
compatible = "st,stm32-i2c-v2", "st,stm32f7-i2c"
> BR,
> Cedric
>
Thanks,
Neil
next prev parent reply other threads:[~2017-03-17 14:54 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-17 9:58 [PATCH 0/5] Add support for the STM32F7 I2C M'boumba Cedric Madianga
2017-03-17 9:58 ` [PATCH 1/5] dt-bindings: i2c-stm32: Document the STM32F7 I2C bindings M'boumba Cedric Madianga
2017-03-24 13:46 ` Rob Herring
2017-03-17 9:58 ` [PATCH 2/5] i2c: i2c-stm32f4: use generic definition of speed enum M'boumba Cedric Madianga
2017-03-17 9:58 ` [PATCH 3/5] i2c: i2c-stm32f7: add driver M'boumba Cedric Madianga
2017-03-17 10:42 ` Neil Armstrong
2017-03-17 13:52 ` M'boumba Cedric Madianga
2017-03-17 14:53 ` Neil Armstrong [this message]
2017-03-17 15:35 ` M'boumba Cedric Madianga
2017-03-17 15:51 ` Neil Armstrong
2017-03-17 22:38 ` M'boumba Cedric Madianga
2017-03-23 20:17 ` Wolfram Sang
2017-03-23 20:40 ` M'boumba Cedric Madianga
2017-03-23 20:42 ` Wolfram Sang
2017-03-17 9:58 ` [PATCH 4/5] ARM: dts: stm32: Add I2C1 support for STM32F746 SoC M'boumba Cedric Madianga
2017-03-17 9:58 ` [PATCH 5/5] ARM: dts: stm32: Add I2C1 support for STM32F746 eval board 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=971895d3-2fe6-ecb6-9dc3-ee71193b34ee@baylibre.com \
--to=narmstrong@baylibre.com \
--cc=alexandre.torgue@st.com \
--cc=cedric.madianga@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=mcoquelin.stm32@gmail.com \
--cc=pierre-yves.mordret@st.com \
--cc=robh+dt@kernel.org \
--cc=wsa@the-dreams.de \
/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
all inboxes | Powered by JetHome®