
Hi Heiko
On 08/09/2017 06:10 AM, Heiko Schocher wrote:
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!
V2 is in the pipe ;-)
Thanks
Patrice
bye, Heiko