Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1732310 > unrolled thread
| Started by | Pierre-Yves MORDRET <pierre-yves.mordret@st.com> |
|---|---|
| First post | 2017-09-14 16:40 +0200 |
| Last post | 2017-09-14 17:40 +0200 |
| Articles | 5 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH v4 0/5] Add support for the STM32F7 I2C Pierre-Yves MORDRET <pierre-yves.mordret@st.com> - 2017-09-14 16:40 +0200
[PATCH v4 2/5] i2c: i2c-stm32f4: use generic definition of speed enum Pierre-Yves MORDRET <pierre-yves.mordret@st.com> - 2017-09-14 16:40 +0200
Re: [PATCH v4 2/5] i2c: i2c-stm32f4: use generic definition of speed enum Wolfram Sang <wsa@the-dreams.de> - 2017-09-14 17:40 +0200
[PATCH v4 1/5] dt-bindings: i2c-stm32: Document the STM32F7 I2C bindings Pierre-Yves MORDRET <pierre-yves.mordret@st.com> - 2017-09-14 16:40 +0200
Re: [PATCH v4 1/5] dt-bindings: i2c-stm32: Document the STM32F7 I2C bindings Wolfram Sang <wsa@the-dreams.de> - 2017-09-14 17:40 +0200
| From | Pierre-Yves MORDRET <pierre-yves.mordret@st.com> |
|---|---|
| Date | 2017-09-14 16:40 +0200 |
| Subject | [PATCH v4 0/5] Add support for the STM32F7 I2C |
| Message-ID | <upDjr-6by-3@gated-at.bofh.it> |
This patchset adds support for the I2C controller embedded in STM32F7xx SoC.
It enables I2C transfer in interrupt mode with Standard-mode, Fast-mode and
Fast-mode+ bus speed.
---
Version history:
v4:
* Fix max I2C Bus clock to 100%
* Solve typo issue
* Add retries value
v3:
* Move stm32f7_i2c_match above stm32f7_i2c_driver
* of_device_get_match_data instead of of_match_device
* Improve I2C Speed DT gathering
* dev_err into dev_dbg for Arbitration loss
* Remove useless space aligned
v2:
* Implement an I2C timings computation algorithm instead of static
values(bindings). Algorithm uses generic I2C SCL Falling/Rising
bindings and System clock to compute its timings.
* I2C Device Tree Update
---
Pierre-Yves MORDRET (5):
dt-bindings: i2c-stm32: Document the STM32F7 I2C bindings
i2c: i2c-stm32f4: use generic definition of speed enum
i2c: i2c-stm32f7: add driver
ARM: dts: stm32: Add I2C1 support for STM32F746 SoC
ARM: dts: stm32: Add I2C1 support for STM32F746 eval board
.../devicetree/bindings/i2c/i2c-stm32.txt | 29 +-
arch/arm/boot/dts/stm32746g-eval.dts | 8 +
arch/arm/boot/dts/stm32f746.dtsi | 22 +
drivers/i2c/busses/Kconfig | 10 +
drivers/i2c/busses/Makefile | 1 +
drivers/i2c/busses/i2c-stm32.h | 20 +
drivers/i2c/busses/i2c-stm32f4.c | 18 +-
drivers/i2c/busses/i2c-stm32f7.c | 972 +++++++++++++++++++++
8 files changed, 1066 insertions(+), 14 deletions(-)
create mode 100644 drivers/i2c/busses/i2c-stm32.h
create mode 100644 drivers/i2c/busses/i2c-stm32f7.c
--
2.7.4
[toc] | [next] | [standalone]
| From | Pierre-Yves MORDRET <pierre-yves.mordret@st.com> |
|---|---|
| Date | 2017-09-14 16:40 +0200 |
| Subject | [PATCH v4 2/5] i2c: i2c-stm32f4: use generic definition of speed enum |
| Message-ID | <upDt8-6ey-13@gated-at.bofh.it> |
| In reply to | #1732310 |
This patch uses a more generic definition of speed enum for i2c-stm32f4
driver.
Signed-off-by: M'boumba Cedric Madianga <cedric.madianga@gmail.com>
Signed-off-by: Pierre-Yves MORDRET <pierre-yves.mordret@st.com>
Reviewed-by: Ludovic BARRE <ludovic.barre@st.com>
---
Version history:
v4:
v3:
v2:
* None
---
---
drivers/i2c/busses/i2c-stm32.h | 20 ++++++++++++++++++++
drivers/i2c/busses/i2c-stm32f4.c | 18 +++++++-----------
2 files changed, 27 insertions(+), 11 deletions(-)
create mode 100644 drivers/i2c/busses/i2c-stm32.h
diff --git a/drivers/i2c/busses/i2c-stm32.h b/drivers/i2c/busses/i2c-stm32.h
new file mode 100644
index 0000000..dab5176
--- /dev/null
+++ b/drivers/i2c/busses/i2c-stm32.h
@@ -0,0 +1,20 @@
+/*
+ * i2c-stm32.h
+ *
+ * Copyright (C) M'boumba Cedric Madianga 2017
+ * Author: M'boumba Cedric Madianga <cedric.madianga@gmail.com>
+ *
+ * License terms: GNU General Public License (GPL), version 2
+ */
+
+#ifndef _I2C_STM32_H
+#define _I2C_STM32_H
+
+enum stm32_i2c_speed {
+ STM32_I2C_SPEED_STANDARD, /* 100 kHz */
+ STM32_I2C_SPEED_FAST, /* 400 kHz */
+ STM32_I2C_SPEED_FAST_PLUS, /* 1 MHz */
+ STM32_I2C_SPEED_END,
+};
+
+#endif /* _I2C_STM32_H */
diff --git a/drivers/i2c/busses/i2c-stm32f4.c b/drivers/i2c/busses/i2c-stm32f4.c
index f9dd7e8..b81557d 100644
--- a/drivers/i2c/busses/i2c-stm32f4.c
+++ b/drivers/i2c/busses/i2c-stm32f4.c
@@ -27,6 +27,8 @@
#include <linux/platform_device.h>
#include <linux/reset.h>
+#include "i2c-stm32.h"
+
/* STM32F4 I2C offset registers */
#define STM32F4_I2C_CR1 0x00
#define STM32F4_I2C_CR2 0x04
@@ -90,12 +92,6 @@
#define STM32F4_I2C_MAX_FREQ 46U
#define HZ_TO_MHZ 1000000
-enum stm32f4_i2c_speed {
- STM32F4_I2C_SPEED_STANDARD, /* 100 kHz */
- STM32F4_I2C_SPEED_FAST, /* 400 kHz */
- STM32F4_I2C_SPEED_END,
-};
-
/**
* struct stm32f4_i2c_msg - client specific data
* @addr: 8-bit slave addr, including r/w bit
@@ -159,7 +155,7 @@ static int stm32f4_i2c_set_periph_clk_freq(struct stm32f4_i2c_dev *i2c_dev)
i2c_dev->parent_rate = clk_get_rate(i2c_dev->clk);
freq = DIV_ROUND_UP(i2c_dev->parent_rate, HZ_TO_MHZ);
- if (i2c_dev->speed == STM32F4_I2C_SPEED_STANDARD) {
+ if (i2c_dev->speed == STM32_I2C_SPEED_STANDARD) {
/*
* To reach 100 kHz, the parent clk frequency should be between
* a minimum value of 2 MHz and a maximum value of 46 MHz due
@@ -216,7 +212,7 @@ static void stm32f4_i2c_set_rise_time(struct stm32f4_i2c_dev *i2c_dev)
* is not higher than 46 MHz . As a result trise is at most 4 bits wide
* and so fits into the TRISE bits [5:0].
*/
- if (i2c_dev->speed == STM32F4_I2C_SPEED_STANDARD)
+ if (i2c_dev->speed == STM32_I2C_SPEED_STANDARD)
trise = freq + 1;
else
trise = freq * 3 / 10 + 1;
@@ -230,7 +226,7 @@ static void stm32f4_i2c_set_speed_mode(struct stm32f4_i2c_dev *i2c_dev)
u32 val;
u32 ccr = 0;
- if (i2c_dev->speed == STM32F4_I2C_SPEED_STANDARD) {
+ if (i2c_dev->speed == STM32_I2C_SPEED_STANDARD) {
/*
* In standard mode:
* t_scl_high = t_scl_low = CCR * I2C parent clk period
@@ -808,10 +804,10 @@ static int stm32f4_i2c_probe(struct platform_device *pdev)
udelay(2);
reset_control_deassert(rst);
- i2c_dev->speed = STM32F4_I2C_SPEED_STANDARD;
+ i2c_dev->speed = STM32_I2C_SPEED_STANDARD;
ret = of_property_read_u32(np, "clock-frequency", &clk_rate);
if (!ret && clk_rate >= 400000)
- i2c_dev->speed = STM32F4_I2C_SPEED_FAST;
+ i2c_dev->speed = STM32_I2C_SPEED_FAST;
i2c_dev->dev = &pdev->dev;
--
2.7.4
[toc] | [prev] | [next] | [standalone]
| From | Wolfram Sang <wsa@the-dreams.de> |
|---|---|
| Date | 2017-09-14 17:40 +0200 |
| Subject | Re: [PATCH v4 2/5] i2c: i2c-stm32f4: use generic definition of speed enum |
| Message-ID | <upEpc-6NY-9@gated-at.bofh.it> |
| In reply to | #1732311 |
[Multipart message — attachments visible in raw view] — view raw
On Thu, Sep 14, 2017 at 04:28:36PM +0200, Pierre-Yves MORDRET wrote: > This patch uses a more generic definition of speed enum for i2c-stm32f4 > driver. > > Signed-off-by: M'boumba Cedric Madianga <cedric.madianga@gmail.com> > Signed-off-by: Pierre-Yves MORDRET <pierre-yves.mordret@st.com> > Reviewed-by: Ludovic BARRE <ludovic.barre@st.com> Applied to for-next, thanks!
[toc] | [prev] | [next] | [standalone]
| From | Pierre-Yves MORDRET <pierre-yves.mordret@st.com> |
|---|---|
| Date | 2017-09-14 16:40 +0200 |
| Subject | [PATCH v4 1/5] dt-bindings: i2c-stm32: Document the STM32F7 I2C bindings |
| Message-ID | <upDt8-6ey-31@gated-at.bofh.it> |
| In reply to | #1732310 |
This patch adds the documentation of device tree bindings for STM32F7 I2C
Signed-off-by: M'boumba Cedric Madianga <cedric.madianga@gmail.com>
Signed-off-by: Pierre-Yves MORDRET <pierre-yves.mordret@st.com>
Acked-by: Rob Herring <robh@kernel.org>
---
Version history:
v4:
v3:
* None
v2:
* Remove i2c-timing binding in order to use generic bindings SCL
Rising and Falling time instead
---
---
.../devicetree/bindings/i2c/i2c-stm32.txt | 29 +++++++++++++++++++---
1 file changed, 26 insertions(+), 3 deletions(-)
diff --git a/Documentation/devicetree/bindings/i2c/i2c-stm32.txt b/Documentation/devicetree/bindings/i2c/i2c-stm32.txt
index 78eaf7b..3b54899 100644
--- a/Documentation/devicetree/bindings/i2c/i2c-stm32.txt
+++ b/Documentation/devicetree/bindings/i2c/i2c-stm32.txt
@@ -1,7 +1,9 @@
* I2C controller embedded in STMicroelectronics STM32 I2C platform
Required properties :
-- compatible : Must be "st,stm32f4-i2c"
+- compatible : Must be one of the following
+ - "st,stm32f4-i2c"
+ - "st,stm32f7-i2c"
- reg : Offset and length of the register set for the device
- interrupts : Must contain the interrupt id for I2C event and then the
interrupt id for I2C error.
@@ -14,8 +16,16 @@ Required properties :
Optional properties :
- clock-frequency : Desired I2C bus clock frequency in Hz. If not specified,
- the default 100 kHz frequency will be used. As only Normal and Fast modes
- are supported, possible values are 100000 and 400000.
+ the default 100 kHz frequency will be used.
+ For STM32F4 SoC Standard-mode and Fast-mode are supported, possible values are
+ 100000 and 400000.
+ For STM32F7 SoC, Standard-mode, Fast-mode and Fast-mode Plus are supported,
+ possible values are 100000, 400000 and 1000000.
+- i2c-scl-rising-time-ns : Only for STM32F7, I2C SCL Rising time for the board
+ (default: 25)
+- i2c-scl-falling-time-ns : Only for STM32F7, I2C SCL Falling time for the board
+ (default: 10)
+ I2C Timings are derived from these 2 values
Example :
@@ -31,3 +41,16 @@ Example :
pinctrl-0 = <&i2c1_sda_pin>, <&i2c1_scl_pin>;
pinctrl-names = "default";
};
+
+ i2c@40005400 {
+ compatible = "st,stm32f7-i2c";
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <0x40005400 0x400>;
+ interrupts = <31>,
+ <32>;
+ resets = <&rcc STM32F7_APB1_RESET(I2C1)>;
+ clocks = <&rcc 1 CLK_I2C1>;
+ pinctrl-0 = <&i2c1_sda_pin>, <&i2c1_scl_pin>;
+ pinctrl-names = "default";
+ };
--
2.7.4
[toc] | [prev] | [next] | [standalone]
| From | Wolfram Sang <wsa@the-dreams.de> |
|---|---|
| Date | 2017-09-14 17:40 +0200 |
| Subject | Re: [PATCH v4 1/5] dt-bindings: i2c-stm32: Document the STM32F7 I2C bindings |
| Message-ID | <upEpc-6NY-11@gated-at.bofh.it> |
| In reply to | #1732316 |
[Multipart message — attachments visible in raw view] — view raw
On Thu, Sep 14, 2017 at 04:28:35PM +0200, Pierre-Yves MORDRET wrote: > This patch adds the documentation of device tree bindings for STM32F7 I2C > > Signed-off-by: M'boumba Cedric Madianga <cedric.madianga@gmail.com> > Signed-off-by: Pierre-Yves MORDRET <pierre-yves.mordret@st.com> > Acked-by: Rob Herring <robh@kernel.org> Applied to for-next, thanks!
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web