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


Groups > linux.kernel > #1412404

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

From Maxime Coquelin <mcoquelin.stm32@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH 2/5] i2c: Add STM32F4 I2C driver
Date 2016-06-02 18:10 +0200
Message-ID <rFDm2-82K-53@gated-at.bofh.it> (permalink)
References (2 earlier) <rzJNw-2Rf-23@gated-at.bofh.it> <rA45A-7no-9@gated-at.bofh.it> <rFf0l-Xx-13@gated-at.bofh.it> <rFfa1-11j-1@gated-at.bofh.it> <rFCSZ-7Dw-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi Cedric,

2016-06-02 17:35 GMT+02:00 M'boumba Cedric Madianga <cedric.madianga@gmail.com>:
> 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?
Or maybe it gets re-initialized as soon as the clk is disabled?

Thanks for the inputs,
Maxime

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


Thread

Re: [PATCH 2/5] i2c: Add STM32F4 I2C driver "M'boumba Cedric Madianga" <cedric.madianga@gmail.com> - 2016-06-01 16:10 +0200
  Re: [PATCH 2/5] i2c: Add STM32F4 I2C driver Maxime Coquelin <mcoquelin.stm32@gmail.com> - 2016-06-01 16:20 +0200
    Re: [PATCH 2/5] i2c: Add STM32F4 I2C driver "M'boumba Cedric Madianga" <cedric.madianga@gmail.com> - 2016-06-02 17:40 +0200
      Re: [PATCH 2/5] i2c: Add STM32F4 I2C driver Maxime Coquelin <mcoquelin.stm32@gmail.com> - 2016-06-02 18:10 +0200
        Re: [PATCH 2/5] i2c: Add STM32F4 I2C driver "M'boumba Cedric Madianga" <cedric.madianga@gmail.com> - 2016-06-03 09:50 +0200

csiph-web