2018-03-01 10:42:28

by Patrice CHOTARD

[permalink] [raw]
Subject: [PATCH 0/6] Add mmc support for STM32F7 boards

From: Patrice Chotard <[email protected]>

This series adds :
_ SDIO pins definition for STM32F7 SoCs family
_ add sdio1 DT entry for STM32F746 Discovery board
_ add sdio1 DT entry for STM32F746 Evaluation board
_ add sdio1 DT entry for STM32F769 Discovery board
_ add SDMMC2 entry in stm32f7-rcc.h
_ replace sdio2 hard coded value in stm32f746.dtsi

Patrice Chotard (6):
ARM: dts: stm32: Add sdio pins definition for stm32f7
ARM: dts: stm32: Enable sdio1 for stm32f746-disco
ARM: dts: stm32: Enable sdio1 for stm32f746-eval
ARM: dts: stm32: Enable sdio1 for stm32f769-disco
dt-bindings: mfd: Add STM32F7 SDMMC2 rcc entry
ARM: dts: stm32: Fix sdio2 rcc hard coded value

arch/arm/boot/dts/stm32746g-eval.dts | 17 ++++++++++
arch/arm/boot/dts/stm32f7-pinctrl.dtsi | 62 ++++++++++++++++++++++++++++++++++
arch/arm/boot/dts/stm32f746-disco.dts | 19 +++++++++++
arch/arm/boot/dts/stm32f746.dtsi | 2 +-
arch/arm/boot/dts/stm32f769-disco.dts | 19 +++++++++++
include/dt-bindings/mfd/stm32f7-rcc.h | 1 +
6 files changed, 119 insertions(+), 1 deletion(-)

--
1.9.1



2018-03-01 09:46:28

by Patrice CHOTARD

[permalink] [raw]
Subject: [PATCH 6/6] ARM: dts: stm32: Fix sdio2 rcc hard coded value

From: Patrice Chotard <[email protected]>

Replace sdio2 rcc hard coded clock value by its macro.

Signed-off-by: Patrice Chotard <[email protected]>
---
arch/arm/boot/dts/stm32f746.dtsi | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/stm32f746.dtsi b/arch/arm/boot/dts/stm32f746.dtsi
index 07c29658696c..2c5704f96801 100644
--- a/arch/arm/boot/dts/stm32f746.dtsi
+++ b/arch/arm/boot/dts/stm32f746.dtsi
@@ -432,7 +432,7 @@
compatible = "arm,pl180", "arm,primecell";
arm,primecell-periphid = <0x00880180>;
reg = <0x40011c00 0x400>;
- clocks = <&rcc 0 167>;
+ clocks = <&rcc 0 STM32F7_APB2_CLOCK(SDMMC2)>;
clock-names = "apb_pclk";
interrupts = <103>;
max-frequency = <48000000>;
--
1.9.1


2018-03-01 09:48:35

by Patrice CHOTARD

[permalink] [raw]
Subject: [PATCH 5/6] dt-bindings: mfd: Add STM32F7 SDMMC2 rcc entry

From: Patrice Chotard <[email protected]>

STM32F769 SoC provides 2 SDMMC instances, add missing
RCC SDMMC2 entry for it.

Signed-off-by: Patrice Chotard <[email protected]>
---
include/dt-bindings/mfd/stm32f7-rcc.h | 1 +
1 file changed, 1 insertion(+)

diff --git a/include/dt-bindings/mfd/stm32f7-rcc.h b/include/dt-bindings/mfd/stm32f7-rcc.h
index 8b7b7197ffd7..a90f3613c584 100644
--- a/include/dt-bindings/mfd/stm32f7-rcc.h
+++ b/include/dt-bindings/mfd/stm32f7-rcc.h
@@ -91,6 +91,7 @@
#define STM32F7_RCC_APB2_TIM8 1
#define STM32F7_RCC_APB2_USART1 4
#define STM32F7_RCC_APB2_USART6 5
+#define STM32F7_RCC_APB2_SDMMC2 7
#define STM32F7_RCC_APB2_ADC1 8
#define STM32F7_RCC_APB2_ADC2 9
#define STM32F7_RCC_APB2_ADC3 10
--
1.9.1


2018-03-01 09:49:10

by Patrice CHOTARD

[permalink] [raw]
Subject: [PATCH 2/6] ARM: dts: stm32: Enable sdio1 for stm32f746-disco

From: Patrice Chotard <[email protected]>

Adds SDIO related DT nodes for stm32f746-disco board.

Signed-off-by: Patrice Chotard <[email protected]>
---
arch/arm/boot/dts/stm32f746-disco.dts | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)

diff --git a/arch/arm/boot/dts/stm32f746-disco.dts b/arch/arm/boot/dts/stm32f746-disco.dts
index 623b6f2bc361..ab65f812e8ae 100644
--- a/arch/arm/boot/dts/stm32f746-disco.dts
+++ b/arch/arm/boot/dts/stm32f746-disco.dts
@@ -44,6 +44,7 @@
#include "stm32f746.dtsi"
#include "stm32f746-pinctrl.dtsi"
#include <dt-bindings/input/input.h>
+#include <dt-bindings/gpio/gpio.h>

/ {
model = "STMicroelectronics STM32F746-DISCO board";
@@ -76,12 +77,30 @@
regulator-name = "vcc5_host1";
regulator-always-on;
};
+
+ mmc_vcard: mmc_vcard {
+ compatible = "regulator-fixed";
+ regulator-name = "mmc_vcard";
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
+ };
};

&clk_hse {
clock-frequency = <25000000>;
};

+&sdio1 {
+ status = "okay";
+ vmmc-supply = <&mmc_vcard>;
+ cd-gpios = <&gpioc 13 GPIO_ACTIVE_HIGH>;
+ cd-inverted;
+ pinctrl-names = "default", "opendrain";
+ pinctrl-0 = <&sdio_pins>;
+ pinctrl-1 = <&sdio_pins_od>;
+ bus-width = <4>;
+};
+
&usart1 {
pinctrl-0 = <&usart1_pins_b>;
pinctrl-names = "default";
--
1.9.1


2018-03-01 09:49:45

by Patrice CHOTARD

[permalink] [raw]
Subject: [PATCH 3/6] ARM: dts: stm32: Enable sdio1 for stm32f746-eval

From: Patrice Chotard <[email protected]>

Adds SDIO related DT nodes for stm32f746-eval board.

broken-cd property is needed as card detect signal is
connected to a GPIO expander which is not yet supported
in kernel linux.

Signed-off-by: Patrice Chotard <[email protected]>
---
arch/arm/boot/dts/stm32746g-eval.dts | 17 +++++++++++++++++
1 file changed, 17 insertions(+)

diff --git a/arch/arm/boot/dts/stm32746g-eval.dts b/arch/arm/boot/dts/stm32746g-eval.dts
index b2d4b8c46677..63160199e39a 100644
--- a/arch/arm/boot/dts/stm32746g-eval.dts
+++ b/arch/arm/boot/dts/stm32746g-eval.dts
@@ -91,6 +91,13 @@
clocks = <&rcc 0 STM32F7_AHB1_CLOCK(OTGHSULPI)>;
clock-names = "main_clk";
};
+
+ mmc_vcard: mmc_vcard {
+ compatible = "regulator-fixed";
+ regulator-name = "mmc_vcard";
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
+ };
};

&clk_hse {
@@ -113,6 +120,16 @@
status = "okay";
};

+&sdio1 {
+ status = "okay";
+ vmmc-supply = <&mmc_vcard>;
+ broken-cd;
+ pinctrl-names = "default", "opendrain";
+ pinctrl-0 = <&sdio_pins>;
+ pinctrl-1 = <&sdio_pins_od>;
+ bus-width = <4>;
+};
+
&usart1 {
pinctrl-0 = <&usart1_pins_a>;
pinctrl-names = "default";
--
1.9.1


2018-03-01 09:50:03

by Patrice CHOTARD

[permalink] [raw]
Subject: [PATCH 4/6] ARM: dts: stm32: Enable sdio1 for stm32f769-disco

From: Patrice Chotard <[email protected]>

Adds SDIO related DT nodes for stm32f769-disco board.

broken-cd property is needed as it misses a pullup on board
(resistor R76 is missing).

Signed-off-by: Patrice Chotard <[email protected]>
---
arch/arm/boot/dts/stm32f769-disco.dts | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)

diff --git a/arch/arm/boot/dts/stm32f769-disco.dts b/arch/arm/boot/dts/stm32f769-disco.dts
index 9dba286c6d2f..2d922b5d4766 100644
--- a/arch/arm/boot/dts/stm32f769-disco.dts
+++ b/arch/arm/boot/dts/stm32f769-disco.dts
@@ -44,6 +44,7 @@
#include "stm32f746.dtsi"
#include "stm32f769-pinctrl.dtsi"
#include <dt-bindings/input/input.h>
+#include <dt-bindings/gpio/gpio.h>

/ {
model = "STMicroelectronics STM32F769-DISCO board";
@@ -62,6 +63,12 @@
serial0 = &usart1;
};

+ mmc_vcard: mmc_vcard {
+ compatible = "regulator-fixed";
+ regulator-name = "mmc_vcard";
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
+ };
};

&cec {
@@ -74,6 +81,18 @@
clock-frequency = <25000000>;
};

+&sdio2 {
+ status = "okay";
+ vmmc-supply = <&mmc_vcard>;
+ cd-gpios = <&gpioi 15 GPIO_ACTIVE_HIGH>;
+ cd-inverted;
+ broken-cd;
+ pinctrl-names = "default", "opendrain";
+ pinctrl-0 = <&sdio_pins_b>;
+ pinctrl-1 = <&sdio_pins_od_b>;
+ bus-width = <4>;
+};
+
&usart1 {
pinctrl-0 = <&usart1_pins_a>;
pinctrl-names = "default";
--
1.9.1


2018-03-01 09:50:16

by Patrice CHOTARD

[permalink] [raw]
Subject: [PATCH 1/6] ARM: dts: stm32: Add sdio pins definition for stm32f7

From: Patrice Chotard <[email protected]>

Add sdio pins definition for the 2 sdio instances embeds in stm32f746.

Signed-off-by: Patrice Chotard <[email protected]>
---
arch/arm/boot/dts/stm32f7-pinctrl.dtsi | 62 ++++++++++++++++++++++++++++++++++
1 file changed, 62 insertions(+)

diff --git a/arch/arm/boot/dts/stm32f7-pinctrl.dtsi b/arch/arm/boot/dts/stm32f7-pinctrl.dtsi
index f518de184e52..fb40f0835dd4 100644
--- a/arch/arm/boot/dts/stm32f7-pinctrl.dtsi
+++ b/arch/arm/boot/dts/stm32f7-pinctrl.dtsi
@@ -222,6 +222,68 @@
slew-rate = <2>;
};
};
+
+ sdio_pins: sdio_pins@0 {
+ pins {
+ pinmux = <STM32_PINMUX('C', 8, AF12)>, /* SDMMC1 D0 */
+ <STM32_PINMUX('C', 9, AF12)>, /* SDMMC1 D1 */
+ <STM32_PINMUX('C', 10, AF12)>, /* SDMMC1 D2 */
+ <STM32_PINMUX('C', 11, AF12)>, /* SDMMC1 D3 */
+ <STM32_PINMUX('C', 12, AF12)>, /* SDMMC1 CLK */
+ <STM32_PINMUX('D', 2, AF12)>; /* SDMMC1 CMD */
+ drive-push-pull;
+ slew-rate = <2>;
+ };
+ };
+
+ sdio_pins_od: sdio_pins_od@0 {
+ pins1 {
+ pinmux = <STM32_PINMUX('C', 8, AF12)>, /* SDMMC1 D0 */
+ <STM32_PINMUX('C', 9, AF12)>, /* SDMMC1 D1 */
+ <STM32_PINMUX('C', 10, AF12)>, /* SDMMC1 D2 */
+ <STM32_PINMUX('C', 11, AF12)>, /* SDMMC1 D3 */
+ <STM32_PINMUX('C', 12, AF12)>; /* SDMMC1 CLK */
+ drive-push-pull;
+ slew-rate = <2>;
+ };
+
+ pins2 {
+ pinmux = <STM32_PINMUX('D', 2, AF12)>; /* SDMMC1 CMD */
+ drive-open-drain;
+ slew-rate = <2>;
+ };
+ };
+
+ sdio_pins_b: sdio_pins_b@0 {
+ pins {
+ pinmux = <STM32_PINMUX('G', 9, AF11)>, /* SDMMC2 D0 */
+ <STM32_PINMUX('G', 10, AF11)>, /* SDMMC2 D1 */
+ <STM32_PINMUX('B', 3, AF10)>, /* SDMMC2 D2 */
+ <STM32_PINMUX('B', 4, AF10)>, /* SDMMC2 D3 */
+ <STM32_PINMUX('D', 6, AF11)>, /* SDMMC2 CLK */
+ <STM32_PINMUX('D', 7, AF11)>; /* SDMMC2 CMD */
+ drive-push-pull;
+ slew-rate = <2>;
+ };
+ };
+
+ sdio_pins_od_b: sdio_pins_od_b@0 {
+ pins1 {
+ pinmux = <STM32_PINMUX('G', 9, AF11)>, /* SDMMC2 D0 */
+ <STM32_PINMUX('G', 10, AF11)>, /* SDMMC2 D1 */
+ <STM32_PINMUX('B', 3, AF10)>, /* SDMMC2 D2 */
+ <STM32_PINMUX('B', 4, AF10)>, /* SDMMC2 D3 */
+ <STM32_PINMUX('D', 6, AF11)>; /* SDMMC2 CLK */
+ drive-push-pull;
+ slew-rate = <2>;
+ };
+
+ pins2 {
+ pinmux = <STM32_PINMUX('D', 7, AF11)>; /* SDMMC2 CMD */
+ drive-open-drain;
+ slew-rate = <2>;
+ };
+ };
};
};
};
--
1.9.1


2018-03-01 09:52:59

by Alexandre Torgue

[permalink] [raw]
Subject: Re: [PATCH 1/6] ARM: dts: stm32: Add sdio pins definition for stm32f7

Hi Patrice

On 03/01/2018 10:43 AM, [email protected] wrote:
> From: Patrice Chotard <[email protected]>
>
> Add sdio pins definition for the 2 sdio instances embeds in stm32f746.
>
> Signed-off-by: Patrice Chotard <[email protected]>
> ---
> arch/arm/boot/dts/stm32f7-pinctrl.dtsi | 62 ++++++++++++++++++++++++++++++++++
> 1 file changed, 62 insertions(+)
>
> diff --git a/arch/arm/boot/dts/stm32f7-pinctrl.dtsi b/arch/arm/boot/dts/stm32f7-pinctrl.dtsi
> index f518de184e52..fb40f0835dd4 100644
> --- a/arch/arm/boot/dts/stm32f7-pinctrl.dtsi
> +++ b/arch/arm/boot/dts/stm32f7-pinctrl.dtsi
> @@ -222,6 +222,68 @@
> slew-rate = <2>;
> };
> };
> +
> + sdio_pins: sdio_pins@0 {
> + pins {
> + pinmux = <STM32_PINMUX('C', 8, AF12)>, /* SDMMC1 D0 */
> + <STM32_PINMUX('C', 9, AF12)>, /* SDMMC1 D1 */
> + <STM32_PINMUX('C', 10, AF12)>, /* SDMMC1 D2 */
> + <STM32_PINMUX('C', 11, AF12)>, /* SDMMC1 D3 */
> + <STM32_PINMUX('C', 12, AF12)>, /* SDMMC1 CLK */
> + <STM32_PINMUX('D', 2, AF12)>; /* SDMMC1 CMD */
> + drive-push-pull;
> + slew-rate = <2>;
> + };
> + };

if you have 2 pins groups, please use '_a' for the first one. You could
have something like:

sdio_pins_a
sdio_od_pins_a

and

sdio_pins_b
sdio_od_pins_b

> + sdio_pins_od: sdio_pins_od@0 {
> + pins1 {
> + pinmux = <STM32_PINMUX('C', 8, AF12)>, /* SDMMC1 D0 */
> + <STM32_PINMUX('C', 9, AF12)>, /* SDMMC1 D1 */
> + <STM32_PINMUX('C', 10, AF12)>, /* SDMMC1 D2 */
> + <STM32_PINMUX('C', 11, AF12)>, /* SDMMC1 D3 */
> + <STM32_PINMUX('C', 12, AF12)>; /* SDMMC1 CLK */
> + drive-push-pull;
> + slew-rate = <2>;
> + };
> +
> + pins2 {
> + pinmux = <STM32_PINMUX('D', 2, AF12)>; /* SDMMC1 CMD */
> + drive-open-drain;
> + slew-rate = <2>;
> + };
> + };
> +
> + sdio_pins_b: sdio_pins_b@0 {
> + pins {
> + pinmux = <STM32_PINMUX('G', 9, AF11)>, /* SDMMC2 D0 */
> + <STM32_PINMUX('G', 10, AF11)>, /* SDMMC2 D1 */
> + <STM32_PINMUX('B', 3, AF10)>, /* SDMMC2 D2 */
> + <STM32_PINMUX('B', 4, AF10)>, /* SDMMC2 D3 */
> + <STM32_PINMUX('D', 6, AF11)>, /* SDMMC2 CLK */
> + <STM32_PINMUX('D', 7, AF11)>; /* SDMMC2 CMD */
> + drive-push-pull;
> + slew-rate = <2>;
> + };
> + };
> +
> + sdio_pins_od_b: sdio_pins_od_b@0 {
> + pins1 {
> + pinmux = <STM32_PINMUX('G', 9, AF11)>, /* SDMMC2 D0 */
> + <STM32_PINMUX('G', 10, AF11)>, /* SDMMC2 D1 */
> + <STM32_PINMUX('B', 3, AF10)>, /* SDMMC2 D2 */
> + <STM32_PINMUX('B', 4, AF10)>, /* SDMMC2 D3 */
> + <STM32_PINMUX('D', 6, AF11)>; /* SDMMC2 CLK */
> + drive-push-pull;
> + slew-rate = <2>;
> + };
> +
> + pins2 {
> + pinmux = <STM32_PINMUX('D', 7, AF11)>; /* SDMMC2 CMD */
> + drive-open-drain;
> + slew-rate = <2>;
> + };
> + };
> };
> };
> };
>

2018-03-01 10:19:13

by Patrice CHOTARD

[permalink] [raw]
Subject: Re: [PATCH 1/6] ARM: dts: stm32: Add sdio pins definition for stm32f7

Hi Alex

On 03/01/2018 10:51 AM, Alexandre Torgue wrote:
> Hi Patrice
>
> On 03/01/2018 10:43 AM, [email protected] wrote:
>> From: Patrice Chotard <[email protected]>
>>
>> Add sdio pins definition for the 2 sdio instances embeds in stm32f746.
>>
>> Signed-off-by: Patrice Chotard <[email protected]>
>> ---
>>   arch/arm/boot/dts/stm32f7-pinctrl.dtsi | 62
>> ++++++++++++++++++++++++++++++++++
>>   1 file changed, 62 insertions(+)
>>
>> diff --git a/arch/arm/boot/dts/stm32f7-pinctrl.dtsi
>> b/arch/arm/boot/dts/stm32f7-pinctrl.dtsi
>> index f518de184e52..fb40f0835dd4 100644
>> --- a/arch/arm/boot/dts/stm32f7-pinctrl.dtsi
>> +++ b/arch/arm/boot/dts/stm32f7-pinctrl.dtsi
>> @@ -222,6 +222,68 @@
>>                       slew-rate = <2>;
>>                   };
>>               };
>> +
>> +            sdio_pins: sdio_pins@0 {
>> +                pins {
>> +                    pinmux = <STM32_PINMUX('C', 8, AF12)>, /* SDMMC1
>> D0 */
>> +                         <STM32_PINMUX('C', 9, AF12)>, /* SDMMC1 D1 */
>> +                         <STM32_PINMUX('C', 10, AF12)>, /* SDMMC1 D2 */
>> +                         <STM32_PINMUX('C', 11, AF12)>, /* SDMMC1 D3 */
>> +                         <STM32_PINMUX('C', 12, AF12)>, /* SDMMC1 CLK */
>> +                         <STM32_PINMUX('D', 2, AF12)>; /* SDMMC1 CMD */
>> +                    drive-push-pull;
>> +                    slew-rate = <2>;
>> +                };
>> +            };
>
> if you have 2 pins groups, please use '_a' for the first one. You could
> have something like:
>
> sdio_pins_a
> sdio_od_pins_a
>
> and
>
> sdio_pins_b
> sdio_od_pins_b

Ok, i prepare a v2

Thanks

Patrice

>
>> +            sdio_pins_od: sdio_pins_od@0 {
>> +                pins1 {
>> +                    pinmux = <STM32_PINMUX('C', 8, AF12)>, /* SDMMC1
>> D0 */
>> +                         <STM32_PINMUX('C', 9, AF12)>, /* SDMMC1 D1 */
>> +                         <STM32_PINMUX('C', 10, AF12)>, /* SDMMC1 D2 */
>> +                         <STM32_PINMUX('C', 11, AF12)>, /* SDMMC1 D3 */
>> +                         <STM32_PINMUX('C', 12, AF12)>; /* SDMMC1 CLK */
>> +                    drive-push-pull;
>> +                    slew-rate = <2>;
>> +                };
>> +
>> +                pins2 {
>> +                    pinmux = <STM32_PINMUX('D', 2, AF12)>; /* SDMMC1
>> CMD */
>> +                    drive-open-drain;
>> +                    slew-rate = <2>;
>> +                };
>> +            };
>> +
>> +            sdio_pins_b: sdio_pins_b@0 {
>> +                pins {
>> +                    pinmux = <STM32_PINMUX('G', 9, AF11)>, /* SDMMC2
>> D0 */
>> +                         <STM32_PINMUX('G', 10, AF11)>, /* SDMMC2 D1 */
>> +                         <STM32_PINMUX('B', 3, AF10)>, /* SDMMC2 D2 */
>> +                         <STM32_PINMUX('B', 4, AF10)>, /* SDMMC2 D3 */
>> +                         <STM32_PINMUX('D', 6, AF11)>, /* SDMMC2 CLK */
>> +                         <STM32_PINMUX('D', 7, AF11)>; /* SDMMC2 CMD */
>> +                    drive-push-pull;
>> +                    slew-rate = <2>;
>> +                };
>> +            };
>> +
>> +            sdio_pins_od_b: sdio_pins_od_b@0 {
>> +                pins1 {
>> +                    pinmux = <STM32_PINMUX('G', 9, AF11)>, /* SDMMC2
>> D0 */
>> +                         <STM32_PINMUX('G', 10, AF11)>, /* SDMMC2 D1 */
>> +                         <STM32_PINMUX('B', 3, AF10)>, /* SDMMC2 D2 */
>> +                         <STM32_PINMUX('B', 4, AF10)>, /* SDMMC2 D3 */
>> +                         <STM32_PINMUX('D', 6, AF11)>; /* SDMMC2 CLK */
>> +                    drive-push-pull;
>> +                    slew-rate = <2>;
>> +                };
>> +
>> +                pins2 {
>> +                    pinmux = <STM32_PINMUX('D', 7, AF11)>; /* SDMMC2
>> CMD */
>> +                    drive-open-drain;
>> +                    slew-rate = <2>;
>> +                };
>> +            };
>>           };
>>       };
>>   };
>>