devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "M'boumba Cedric Madianga" <cedric.madianga-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Maxime Coquelin
	<mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Patrice Chotard <patrice.chotard-qxv4g6HH51o@public.gmane.org>,
	Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>,
	Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Russell King <linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org>,
	"linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org"
	<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
	"devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 2/5] i2c: Add STM32F4 I2C driver
Date: Fri, 3 Jun 2016 09:44:43 +0200	[thread overview]
Message-ID: <CAOAejn06djk8h3GLmrXdfX6Y7Rj1W38gih_mgCQ5aLNZAgAvFQ@mail.gmail.com> (raw)
In-Reply-To: <CALszF6A9m1gwTg-HeGSukqbRUUz1cPv5R_-586uKzeVkkpQ93g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

Hi Maxime,

2016-06-02 18:02 GMT+02:00 Maxime Coquelin <mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:
> Hi Cedric,
>
> 2016-06-02 17:35 GMT+02:00 M'boumba Cedric Madianga <cedric.madianga-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:
>> Hi,
>>
>>>> +
>>>> +/**
>>>> + * stm32f4_i2c_xfer() - Transfer combined I2C message
>>>> + * @i2c_adap: Adapter pointer to the controller
>>>> + * @msgs: Pointer to data to be written.
>>>> + * @num: Number of messages to be executed
>>>> + */
>>>> +static int stm32f4_i2c_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msgs[],
>>>> +                           int num)
>>>> +{
>>>> +       struct stm32f4_i2c_dev *i2c_dev = i2c_get_adapdata(i2c_adap);
>>>> +       int ret, i;
>>>> +
>>>> +       i2c_dev->busy = true;
>>>> +
>>>> +       ret = clk_prepare_enable(i2c_dev->clk);
>>>> +       if (ret) {
>>>> +               dev_err(i2c_dev->dev, "Failed to prepare_enable clock\n");
>>>> +               return ret;
>>>> +       }
>>>> +
>>>> +       stm32f4_i2c_hw_config(i2c_dev);
>>> Maybe you could call this only at probe and resume time?
>>> You would save some register accesses.
>> Some clarification about this point.
>> We need to call stm32f4_i2c_hw_config before each I2C transfer as at
>> the end of I2C communication the peripheral is automatically disabled
>> and configuration registers are reset.
>
> Ok, but I wonder how the IP knows this is the last i2c message to be sent?
When the IP is enabled we could generated a STOP at any moment by
setting a bit in CR1 register.
At this moment, the IP knows that this is the last byte to be sent.
After STOP generation, I notice that all registers are automatically
set with their reset values

> Or maybe it gets re-initialized as soon as the clk is disabled?
Not really because they are all re-initialized before disabling the clock

>
> Thanks for the inputs,
> Maxime
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2016-06-03  7:44 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-11 15:36 [PATCH 0/5] Add support for the STM32F4 I2C M'boumba Cedric Madianga
2016-05-11 15:36 ` [PATCH 1/5] dt-bindings: Document the STM32 I2C bindings M'boumba Cedric Madianga
     [not found]   ` <1462980974-22091-2-git-send-email-cedric.madianga-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-05-16 15:04     ` Rob Herring
2016-05-17  7:21       ` M'boumba Cedric Madianga
2016-05-11 15:36 ` [PATCH 2/5] i2c: Add STM32F4 I2C driver M'boumba Cedric Madianga
2016-05-17  9:48   ` Maxime Coquelin
     [not found]     ` <CALszF6A-jiCBtSO1RFDdgHKTKmsonRXFVs0x2zHha1LJ3UhwtQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-05-18  7:24       ` M'boumba Cedric Madianga
2016-06-01 14:01         ` M'boumba Cedric Madianga
     [not found]           ` <CAOAejn1NQDJpGrTwGtpvSfVOGg3UuCkj8wLJ7B5LnW1-Z2VrQA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-06-01 14:14             ` Maxime Coquelin
2016-06-02 15:35               ` M'boumba Cedric Madianga
2016-06-02 16:02                 ` Maxime Coquelin
     [not found]                   ` <CALszF6A9m1gwTg-HeGSukqbRUUz1cPv5R_-586uKzeVkkpQ93g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-06-03  7:44                     ` M'boumba Cedric Madianga [this message]
2016-05-11 15:36 ` [PATCH 3/5] ARM: dts: Add I2C1 support for STM32F429 SoC M'boumba Cedric Madianga
2016-05-11 15:36 ` [PATCH 4/5] ARM: dts: Add I2C1 support for STM32429 eval board M'boumba Cedric Madianga
2016-05-11 15:36 ` [PATCH 5/5] ARM: configs: Add I2C support for STM32 defconfig 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=CAOAejn06djk8h3GLmrXdfX6Y7Rj1W38gih_mgCQ5aLNZAgAvFQ@mail.gmail.com \
    --to=cedric.madianga-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org \
    --cc=mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=patrice.chotard-qxv4g6HH51o@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.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).