public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Heiko Schocher <hs@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/1] i2c: add i2c driver for stm32
Date: Wed, 9 Aug 2017 06:10:19 +0200	[thread overview]
Message-ID: <598A8B2B.9010301@denx.de> (raw)
In-Reply-To: <CAPnjgZ0kRb7Roh=3yDVSxx01kJoo82R_gY2TeH82YCcTg+Uj4g@mail.gmail.com>

Hi Simon, Patrice,

Am 06.08.2017 um 07:15 schrieb Simon Glass:
> Hi Patrice,
>
> On 25 July 2017 at 10:02,  <patrice.chotard@st.com> wrote:
>> From: Patrice Chotard <patrice.chotard@st.com>
>>
>> Add i2c driver which can be used on both STM32F7 and STM32H7.
>> This I2C block supports the following features:
>>   _ Slave and master modes
>>   _ Multimaster capability
>>   _ Standard-mode (up to 100 kHz)
>>   _ Fast-mode (up to 400 kHz)
>>   _ Fast-mode Plus (up to 1 MHz)
>>   _ 7-bit and 10-bit addressing mode
>>   _ Multiple 7-bit slave addresses (2 addresses, 1 with configurable mask)
>>   _ All 7-bit addresses acknowledge mode
>>   _ General call
>>   _ Programmable setup and hold times
>>   _ Easy to use event management
>>   _ Optional clock stretching
>>   _ Software reset
>>
>> Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
>> Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
>> ---
>>   doc/device-tree-bindings/i2c/i2c-stm32.txt |  30 ++
>>   drivers/i2c/Kconfig                        |   7 +
>>   drivers/i2c/Makefile                       |   1 +
>>   drivers/i2c/stm32f7_i2c.c                  | 839 +++++++++++++++++++++++++++++
>>   4 files changed, 877 insertions(+)
>>   create mode 100644 doc/device-tree-bindings/i2c/i2c-stm32.txt
>>   create mode 100644 drivers/i2c/stm32f7_i2c.c
>>
[...]
>> diff --git a/drivers/i2c/stm32f7_i2c.c b/drivers/i2c/stm32f7_i2c.c
>> new file mode 100644
>> index 0000000..255b38a
>> --- /dev/null
>> +++ b/drivers/i2c/stm32f7_i2c.c
>> @@ -0,0 +1,839 @@
>> +/*
>> + * (C) Copyright 2017 STMicroelectronics
>> + *
>> + * SPDX-License-Identifier:    GPL-2.0+
>> + */
>> +
>> +#include <common.h>
>> +#include <clk.h>
>> +#include <dm.h>
>> +#include <i2c.h>
>> +#include <reset.h>
>> +
>> +#include <dm/device.h>
>> +#include <linux/io.h>
>> +
>> +/* STM32 I2C registers */
>> +struct stm32_i2c_regs {
>> +       u32 cr1;        /* I2C control register 1 */
>> +       u32 cr2;        /* I2C control register 2 */
>> +       u32 oar1;       /* I2C own address 1 register */
>> +       u32 oar2;       /* I2C own address 2 register */
>> +       u32 timingr;    /* I2C timing register */
>> +       u32 timeoutr;   /* I2C timeout register */
>> +       u32 isr;        /* I2C interrupt and status register */
>> +       u32 icr;        /* I2C interrupt clear register */
>> +       u32 pecr;       /* I2C packet error checking register */
>> +       u32 rxdr;       /* I2C receive data register */
>> +       u32 txdr;       /* I2C transmit data register */
>> +};
>> +
>> +#define STM32_I2C_CR1                          0x00
>> +#define STM32_I2C_CR2                          0x04
>
> Do you really need these STM32_I2C prefixes?

Why not? I think this makes it clearer reading the drivers code.
Beside of this, I am in sync with Simons comments.

@Patrice: Can you prepare a v2 please? Thanks!

bye,
Heiko
-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

  reply	other threads:[~2017-08-09  4:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-25 16:02 [U-Boot] [PATCH 1/1] i2c: add i2c driver for stm32 patrice.chotard at st.com
2017-08-06  5:15 ` Simon Glass
2017-08-09  4:10   ` Heiko Schocher [this message]
2017-08-09 13:41     ` Patrice CHOTARD
2017-08-09 12:13   ` Patrice CHOTARD

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=598A8B2B.9010301@denx.de \
    --to=hs@denx.de \
    --cc=u-boot@lists.denx.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