Skip to contentSkip to conversation

stm32f7: add clock and pin control drivers

PATCH Superseded Vikas Manocha 2 participants 29 messages Feb 12, 2017 – Mar 18, 2017

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

v3 cover stm32f7: add clock and pin control drivers

This patchset:
- adds support for stm32f7 clock driver.
- adds support for stm32f7 pin control driver.
- adds device tree nodes for stm32f7 serial & clock.
- adds stm32f7 pin control device tree sub nodes :
- serial usart1
- ethernet
- qspi flash

Changed in v3:
- remove get length of pin control sub node as not required in case of fdtdec_get_int_array_count

Changed in v2:
- added removed blank lines in code.
- removed not used functions.
- changed fixed length array read from device node to relaxed length read.

Vikas Manocha (10):
serial: stm32f7: add device tree support
clk: stm32f7: add clock driver for stm32f7 family
stm32f7: serial: use clock driver to enable clock
ARM: DT: stm32f7: add usart1 & clock device tree nodes
stm32f7: clk: remove usart1 clock enable from board init
PINCTRL: stm32f7: add pin control driver
ARM: DT: stm32f7: add pin control device node
ARM: DT: stm32f7: add pin control node for serial port pins
ARM: DT: stm32f7: add ethernet pin contol node
ARM: DT: stm32f7: add qspi pin contol node

 arch/arm/dts/stm32f746-disco.dts                   |  13 ++
 arch/arm/dts/stm32f746.dtsi                        |  72 +++++++++++
 arch/arm/mach-stm32/stm32f7/Makefile               |   2 +-
 arch/arm/mach-stm32/stm32f7/soc.c                  |   2 -
 board/st/stm32f746-disco/stm32f746-disco.c         | 111 +----------------
 configs/stm32f746-disco_defconfig                  |   4 +
 doc/device-tree-bindings/clock/st,stm32-rcc.txt    |  95 +++++++++++++++
 .../pinctrl/st,stm32-pinctrl.txt                   | 133 +++++++++++++++++++++
 drivers/clk/Makefile                               |   2 +-
 .../stm32f7/clock.c => drivers/clk/clk_stm32f7.c   |  64 +++++++++-
 drivers/pinctrl/Kconfig                            |   9 ++
 drivers/pinctrl/Makefile                           |   1 +
 drivers/pinctrl/pinctrl_stm32.c                    | 117 ++++++++++++++++++
 drivers/serial/serial_stm32x7.c                    |  42 +++++++
 14 files changed, 548 insertions(+), 119 deletions(-)
 create mode 100644 doc/device-tree-bindings/clock/st,stm32-rcc.txt
 create mode 100644 doc/device-tree-bindings/pinctrl/st,stm32-pinctrl.txt
 rename arch/arm/mach-stm32/stm32f7/clock.c => drivers/clk/clk_stm32f7.c (85%)
 create mode 100644 drivers/pinctrl/pinctrl_stm32.c
Signature · 1 line
1.9.1
#1 lore raw

PATCH v3 1/10 serial: stm32f7: add device tree support

This patch adds device tree support for stm32f7 serial driver & removes serial platform data structure.

---

Changed in v3: None
Changed in v2: None

 board/st/stm32f746-disco/stm32f746-disco.c | 10 ----------
 drivers/serial/serial_stm32x7.c            | 24 ++++++++++++++++++++++++
 2 files changed, 24 insertions(+), 10 deletions(-)
board/st/stm32f746-disco/stm32f746-disco.c +0 -10
index 7ed7bf7..72212f4 100644
@@ -267,16 +267,6 @@ out:
 	return rv;
 }
 
-static const struct stm32x7_serial_platdata serial_platdata = {
-	.base = (struct stm32_usart *)USART1_BASE,
-	.clock = CONFIG_SYS_CLK_FREQ,
-};
-
-U_BOOT_DEVICE(stm32x7_serials) = {
-	.name = "serial_stm32x7",
-	.platdata = &serial_platdata,
-};
-
 #ifdef CONFIG_ETH_DESIGNWARE
 const struct stm32_gpio_ctl gpio_ctl_eth = {
 	.mode = STM32_GPIO_MODE_AF,
drivers/serial/serial_stm32x7.c +24 -0
index 592c0bd..2e6c676 100644
@@ -81,6 +81,27 @@ static int stm32_serial_probe(struct udevice *dev)
 	return 0;
 }
 
+#if CONFIG_IS_ENABLED(OF_CONTROL)
+static const struct udevice_id stm32_serial_id[] = {
+	{.compatible = "st,stm32-usart"},
+	{.compatible = "st,stm32-uart"},
+	{}
+};
+
+static int stm32_serial_ofdata_to_platdata(struct udevice *dev)
+{
+	struct stm32x7_serial_platdata *plat = dev_get_platdata(dev);
+	fdt_addr_t addr;
+
+	addr = dev_get_addr(dev);
+	if (addr == FDT_ADDR_T_NONE)
+		return -EINVAL;
+
+	plat->base = (struct stm32_usart *)addr;
+	return 0;
+}
+#endif
+
 static const struct dm_serial_ops stm32_serial_ops = {
 	.putc = stm32_serial_putc,
 	.pending = stm32_serial_pending,
@@ -91,6 +112,9 @@ static const struct dm_serial_ops stm32_serial_ops = {
 U_BOOT_DRIVER(serial_stm32) = {
 	.name = "serial_stm32x7",
 	.id = UCLASS_SERIAL,
+	.of_match = of_match_ptr(stm32_serial_id),
+	.ofdata_to_platdata = of_match_ptr(stm32_serial_ofdata_to_platdata),
+	.platdata_auto_alloc_size = sizeof(struct stm32x7_serial_platdata),
 	.ops = &stm32_serial_ops,
 	.probe = stm32_serial_probe,
 	.flags = DM_FLAG_PRE_RELOC,
Signature · 1 line
1.9.1
#2 lore raw

PATCH v3 1/10 serial: stm32f7: add device tree support

Quoted 5 lines · Vikas Manocha

This patch adds device tree support for stm32f7 serial driver & removes serial platform data structure.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170317/312e9a55/attachment.sig>
#3 lore raw

PATCH v3 2/10 clk: stm32f7: add clock driver for stm32f7 family

In reply to Vikas Manocha

add basic clock driver support for stm32f7 to enable clocks required by the peripherals.

---

Changed in v3: None
Changed in v2:
- added blank lines in code like before return and after variable declaration.
- re-arranged header file inclusion as per u-boot guidelines.
- remove not used function.

 arch/arm/mach-stm32/stm32f7/Makefile               |  2 +-
 arch/arm/mach-stm32/stm32f7/soc.c                  |  2 -
 configs/stm32f746-disco_defconfig                  |  1 +
 doc/device-tree-bindings/clock/st,stm32-rcc.txt    | 95 ++++++++++++++++++++++
 drivers/clk/Makefile                               |  2 +-
 .../stm32f7/clock.c => drivers/clk/clk_stm32f7.c   | 61 +++++++++++++-
 6 files changed, 157 insertions(+), 6 deletions(-)
 create mode 100644 doc/device-tree-bindings/clock/st,stm32-rcc.txt
 rename arch/arm/mach-stm32/stm32f7/clock.c => drivers/clk/clk_stm32f7.c (86%)
arch/arm/mach-stm32/stm32f7/Makefile +1 -1
index 643d4d9..03269bd 100644
@@ -5,4 +5,4 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-obj-y += timer.o clock.o soc.o
+obj-y += timer.o soc.o
arch/arm/mach-stm32/stm32f7/soc.c +0 -2
index 8baee99..06af631 100644
@@ -17,8 +17,6 @@ u32 get_cpu_rev(void)
 
 int arch_cpu_init(void)
 {
-	configure_clocks();
-
 	/*
 		* Configure the memory protection unit (MPU)
 		* 0x00000000 - 0xffffffff: Strong-order, Shareable
configs/stm32f746-disco_defconfig +1 -0
index 51b779a..af1449c 100644
@@ -38,3 +38,4 @@ CONFIG_DM_SPI=y
 CONFIG_STM32_QSPI=y
 CONFIG_OF_LIBFDT_OVERLAY=y
 # CONFIG_EFI_LOADER is not set
+CONFIG_CLK=y
doc/device-tree-bindings/clock/st,stm32-rcc.txt new file +95 -0

95 lines not on this page · raw message

drivers/clk/Makefile +1 -1
index 884c21c..1ed29c7 100644
@@ -17,5 +17,5 @@ obj-$(CONFIG_CLK_UNIPHIER) += uniphier/
 obj-$(CONFIG_CLK_EXYNOS) += exynos/
 obj-$(CONFIG_CLK_AT91) += at91/
 obj-$(CONFIG_CLK_BOSTON) += clk_boston.o
-
 obj-$(CONFIG_ARCH_ASPEED) += aspeed/
+obj-$(CONFIG_STM32F7) += clk_stm32f7.o
drivers/clk/clk_stm32f7.c renamed from arch/arm/mach-stm32/stm32f7/clock.c +59 -2

79 lines not on this page · raw message

Signature · 1 line
1.9.1
#4 lore raw

PATCH v3 2/10 clk: stm32f7: add clock driver for stm32f7 family

Quoted 5 lines · Vikas Manocha

add basic clock driver support for stm32f7 to enable clocks required by the peripherals.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170317/b35707b5/attachment.sig>
#5 lore raw

PATCH v3 3/10 stm32f7: serial: use clock driver to enable clock

In reply to Vikas Manocha

---

Changed in v3: None
Changed in v2:
- added blank lines in code like before return and after variable declaration.

 drivers/serial/serial_stm32x7.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
drivers/serial/serial_stm32x7.c +18 -0
index 2e6c676..1907cef 100644
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <clk.h>
 #include <dm.h>
 #include <asm/io.h>
 #include <serial.h>
@@ -76,6 +77,22 @@ static int stm32_serial_probe(struct udevice *dev)
 {
 	struct stm32x7_serial_platdata *plat = dev->platdata;
 	struct stm32_usart *const usart = plat->base;
+
+#ifdef CONFIG_CLK
+	int ret;
+	struct clk clk;
+
+	ret = clk_get_by_index(dev, 0, &clk);
+	if (ret < 0)
+		return ret;
+
+	ret = clk_enable(&clk);
+	if (ret) {
+		dev_err(dev, "failed to enable clock\n");
+		return ret;
+	}
+#endif
+
 	setbits_le32(&usart->cr1, USART_CR1_RE | USART_CR1_TE | USART_CR1_UE);
 
 	return 0;
@@ -98,6 +115,7 @@ static int stm32_serial_ofdata_to_platdata(struct udevice *dev)
 		return -EINVAL;
 
 	plat->base = (struct stm32_usart *)addr;
+
 	return 0;
 }
 #endif
Signature · 1 line
1.9.1
#6 lore raw

PATCH v3 3/10 stm32f7: serial: use clock driver to enable clock

Quoted 2 lines · Vikas Manocha

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170317/1740b621/attachment.sig>
#7 lore raw

PATCH v3 4/10 ARM: DT: stm32f7: add usart1 & clock device tree nodes

In reply to Vikas Manocha

Also created alias for usart1 and specified oscillator clock for stm32f7 discovery board.

---

Changed in v3: None
Changed in v2: None

 arch/arm/dts/stm32f746-disco.dts |  5 +++++
 arch/arm/dts/stm32f746.dtsi      | 27 +++++++++++++++++++++++++++
 2 files changed, 32 insertions(+)
arch/arm/dts/stm32f746-disco.dts +5 -0
index bad0698..454b515 100644
@@ -61,10 +61,15 @@
 	};
 
 	aliases {
+		serial0 = &usart1;
 		spi0 = &qspi;
 	};
 };
 
+&clk_hse {
+	clock-frequency = <25000000>;
+};
+
 &mac {
 	status = "okay";
 	phy-mode = "rmii";
arch/arm/dts/stm32f746.dtsi +27 -0
index 3902e76..afcd327 100644
@@ -48,7 +48,16 @@
 #include <dt-bindings/pinctrl/stm32f746-pinfunc.h>
 
 / {
+	clocks {
+		clk_hse: clk-hse {
+			#clock-cells = <0>;
+			compatible = "fixed-clock";
+			clock-frequency = <0>;
+		};
+};
+
 	soc {
+		u-boot,dm-pre-reloc;
 		mac: ethernet at 40028000 {
 			compatible = "st,stm32-dwmac";
 			reg = <0x40028000 0x8000>;
@@ -71,6 +80,24 @@
 			spi-max-frequency = <108000000>;
 			status = "disabled";
 		};
+		usart1: serial at 40011000 {
+			compatible = "st,stm32-usart", "st,stm32-uart";
+			reg = <0x40011000 0x400>;
+			interrupts = <37>;
+			clocks = <&rcc 0 164>;
+			status = "disabled";
+			u-boot,dm-pre-reloc;
+		};
+		rcc: rcc at 40023810 {
+			#reset-cells = <1>;
+			#clock-cells = <2>;
+			compatible = "st,stm32f42xx-rcc", "st,stm32-rcc";
+			reg = <0x40023800 0x400>;
+			clocks = <&clk_hse>;
+			u-boot,dm-pre-reloc;
+		};
+
+
 	};
 };
 
Signature · 1 line
1.9.1
#8 lore raw

PATCH v3 4/10 ARM: DT: stm32f7: add usart1 & clock device tree nodes

Quoted 4 lines · Vikas Manocha

Also created alias for usart1 and specified oscillator clock for stm32f7 discovery board.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170317/429ca78f/attachment-0001.sig>
#9 lore raw

PATCH v3 5/10 stm32f7: clk: remove usart1 clock enable from board init

In reply to Vikas Manocha

Before clock driver availability it was required to enable usart1 clock for serial init but now with clock driver is taking care of usart1 clock.

---

Changed in v3: None
Changed in v2: None

 board/st/stm32f746-disco/stm32f746-disco.c | 1 -
 drivers/clk/clk_stm32f7.c                  | 3 ---
 2 files changed, 4 deletions(-)
board/st/stm32f746-disco/stm32f746-disco.c +0 -1
index 72212f4..ee1deb5 100644
@@ -380,7 +380,6 @@ int board_early_init_f(void)
 	int res;
 
 	res = uart_setup_gpio();
-	clock_setup(USART1_CLOCK_CFG);
 	if (res)
 		return res;
 
drivers/clk/clk_stm32f7.c +0 -3
index 4c5388a..0d86395 100644
@@ -228,9 +228,6 @@ static int stm32_clk_enable(struct clk *clk)
 void clock_setup(int peripheral)
 {
 	switch (peripheral) {
-	case USART1_CLOCK_CFG:
-		setbits_le32(&STM32_RCC->apb2enr, RCC_APB2ENR_USART1EN);
-		break;
 	case GPIO_A_CLOCK_CFG:
 		setbits_le32(&STM32_RCC->ahb1enr, RCC_AHB1ENR_GPIO_A_EN);
 		break;
Signature · 1 line
1.9.1
#10 lore raw

PATCH v3 5/10 stm32f7: clk: remove usart1 clock enable from board init

Quoted 4 lines · Vikas Manocha

Before clock driver availability it was required to enable usart1 clock for serial init but now with clock driver is taking care of usart1 clock.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170317/c3b8cf48/attachment.sig>
#11 lore raw

PATCH v3 6/10 PINCTRL: stm32f7: add pin control driver

In reply to Vikas Manocha

This driver uses the same pin control binding as that of linux, binding document of this patch is copied from linux. One addition done is for GPIO input and output mode configuration which was missing.

---

Changed in v3:
- remove get length of pin control sub node as not required in case of fdtdec_get_int_array_count

Changed in v2:
- added blank lines in code like before return and after variable declaration.
- remove not used function.
- changed fixed length array read from DT node to relaxed length read.

 configs/stm32f746-disco_defconfig                  |   3 +
 .../pinctrl/st,stm32-pinctrl.txt                   | 133 +++++++++++++++++++++
 drivers/pinctrl/Kconfig                            |   9 ++
 drivers/pinctrl/Makefile                           |   1 +
 drivers/pinctrl/pinctrl_stm32.c                    | 117 ++++++++++++++++++
 5 files changed, 263 insertions(+)
 create mode 100644 doc/device-tree-bindings/pinctrl/st,stm32-pinctrl.txt
 create mode 100644 drivers/pinctrl/pinctrl_stm32.c
configs/stm32f746-disco_defconfig +3 -0
index af1449c..e77ebfc 100644
@@ -39,3 +39,6 @@ CONFIG_STM32_QSPI=y
 CONFIG_OF_LIBFDT_OVERLAY=y
 # CONFIG_EFI_LOADER is not set
 CONFIG_CLK=y
+CONFIG_PINCTRL=y
+# CONFIG_PINCTRL_FULL is not set
+CONFIG_PINCTRL_STM32=y
doc/device-tree-bindings/pinctrl/st,stm32-pinctrl.txt new file +133 -0

133 lines not on this page · raw message

drivers/pinctrl/Kconfig +9 -0
index efcb4c0..2dc420c 100644
@@ -175,6 +175,15 @@ config PIC32_PINCTRL
 	  by a device tree node which contains both GPIO defintion and pin control
 	  functions.
 
+config PINCTRL_STM32
+	bool "ST STM32 pin control driver"
+	depends on DM
+	help
+	  Supports pin multiplexing control on stm32 SoCs. The driver is
+	  controlled by a device tree node which contains both the GPIO
+	  definitions and pin control functions for each available multiplex
+	  function.
+
 endif
 
 source "drivers/pinctrl/meson/Kconfig"
drivers/pinctrl/Makefile +1 -0
index 512112a..2e23b05 100644
@@ -16,3 +16,4 @@ obj-$(CONFIG_PIC32_PINCTRL)	+= pinctrl_pic32.o
 obj-$(CONFIG_PINCTRL_EXYNOS)	+= exynos/
 obj-$(CONFIG_PINCTRL_MESON)	+= meson/
 obj-$(CONFIG_PINCTRL_MVEBU)	+= mvebu/
+obj-$(CONFIG_PINCTRL_STM32)	+= pinctrl_stm32.o
drivers/pinctrl/pinctrl_stm32.c new file +117 -0

117 lines not on this page · raw message

Signature · 1 line
1.9.1
#12 lore raw

PATCH v3 6/10 PINCTRL: stm32f7: add pin control driver

Quoted 6 lines · Vikas Manocha

This driver uses the same pin control binding as that of linux, binding document of this patch is copied from linux. One addition done is for GPIO input and output mode configuration which was missing.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170317/2d21d4a5/attachment.sig>
#13 lore raw

PATCH v3 7/10 ARM: DT: stm32f7: add pin control device node

In reply to Vikas Manocha

---

Changed in v3: None
Changed in v2: None

 arch/arm/dts/stm32f746.dtsi | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
arch/arm/dts/stm32f746.dtsi +8 -1
index afcd327..f59eca8 100644
@@ -97,7 +97,14 @@
 			u-boot,dm-pre-reloc;
 		};
 
-
+		pinctrl: pin-controller {
+			#address-cells = <1>;
+			#size-cells = <1>;
+			compatible = "st,stm32f746-pinctrl";
+			ranges = <0 0x40020000 0x3000>;
+			u-boot,dm-pre-reloc;
+			pins-are-numbered;
+		};
 	};
 };
 
Signature · 1 line
1.9.1
#14 lore raw

PATCH v3 7/10 ARM: DT: stm32f7: add pin control device node

Quoted 1 line · Vikas Manocha

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170317/5a596a1b/attachment.sig>
#15 lore raw

PATCH v3 8/10 ARM: DT: stm32f7: add pin control node for serial port pins

In reply to Vikas Manocha

And remove the uart pin configuration from board initialization.

---

Changed in v3: None
Changed in v2: None

 arch/arm/dts/stm32f746-disco.dts           |  6 ++++++
 arch/arm/dts/stm32f746.dtsi                | 13 +++++++++++++
 board/st/stm32f746-disco/stm32f746-disco.c | 25 +------------------------
 3 files changed, 20 insertions(+), 24 deletions(-)
arch/arm/dts/stm32f746-disco.dts +6 -0
index 454b515..6734f23 100644
@@ -70,6 +70,12 @@
 	clock-frequency = <25000000>;
 };
 
+&usart1 {
+	pinctrl-0 = <&usart1_pins_a>;
+	pinctrl-names = "default";
+	status = "okay";
+};
+
 &mac {
 	status = "okay";
 	phy-mode = "rmii";
arch/arm/dts/stm32f746.dtsi +13 -0
index f59eca8..867f399 100644
@@ -104,6 +104,19 @@
 			ranges = <0 0x40020000 0x3000>;
 			u-boot,dm-pre-reloc;
 			pins-are-numbered;
+
+			usart1_pins_a: usart1 at 0 {
+				pins1 {
+					pinmux = <STM32F746_PA9_FUNC_USART1_TX>;
+					bias-disable;
+					drive-push-pull;
+					slew-rate = <2>;
+				};
+				pins2 {
+					pinmux = <STM32F746_PB7_FUNC_USART1_RX>;
+					bias-disable;
+				};
+			};
 		};
 	};
 };
board/st/stm32f746-disco/stm32f746-disco.c +1 -24
index ee1deb5..9ebc36b 100644
@@ -27,14 +27,6 @@ const struct stm32_gpio_ctl gpio_ctl_gpout = {
 	.af = STM32_GPIO_AF0
 };
 
-const struct stm32_gpio_ctl gpio_ctl_usart = {
-	.mode = STM32_GPIO_MODE_AF,
-	.otype = STM32_GPIO_OTYPE_PP,
-	.speed = STM32_GPIO_SPEED_50M,
-	.pupd = STM32_GPIO_PUPD_UP,
-	.af = STM32_GPIO_AF7
-};
-
 const struct stm32_gpio_ctl gpio_ctl_fmc = {
 	.mode = STM32_GPIO_MODE_AF,
 	.otype = STM32_GPIO_OTYPE_PP,
@@ -245,26 +237,11 @@ int dram_init(void)
 	return rv;
 }
 
-static const struct stm32_gpio_dsc usart_gpio[] = {
-	{STM32_GPIO_PORT_A, STM32_GPIO_PIN_9},	/* TX */
-	{STM32_GPIO_PORT_B, STM32_GPIO_PIN_7},	/* RX */
-};
-
 int uart_setup_gpio(void)
 {
-	int i;
-	int rv = 0;
-
 	clock_setup(GPIO_A_CLOCK_CFG);
 	clock_setup(GPIO_B_CLOCK_CFG);
-	for (i = 0; i < ARRAY_SIZE(usart_gpio); i++) {
-		rv = stm32_gpio_config(&usart_gpio[i], &gpio_ctl_usart);
-		if (rv)
-			goto out;
-	}
-
-out:
-	return rv;
+	return 0;
 }
 
 #ifdef CONFIG_ETH_DESIGNWARE
Signature · 1 line
1.9.1
#16 lore raw

PATCH v3 8/10 ARM: DT: stm32f7: add pin control node for serial port pins

Quoted 3 lines · Vikas Manocha

And remove the uart pin configuration from board initialization.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170317/9002dec1/attachment.sig>
#17 lore raw

PATCH v3 9/10 ARM: DT: stm32f7: add ethernet pin contol node

In reply to Vikas Manocha

It also removes the ethernet pin configuration done during the board initialization.

---

Changed in v3: None
Changed in v2: None

 arch/arm/dts/stm32f746-disco.dts           |  1 +
 arch/arm/dts/stm32f746.dtsi                | 14 +++++++++++++
 board/st/stm32f746-disco/stm32f746-disco.c | 32 ------------------------------
 3 files changed, 15 insertions(+), 32 deletions(-)
arch/arm/dts/stm32f746-disco.dts +1 -0
index 6734f23..3d6002f 100644
@@ -78,6 +78,7 @@
 
 &mac {
 	status = "okay";
+	pinctrl-0 = <&ethernet_mii>;
 	phy-mode = "rmii";
 	phy-handle = <&phy0>;
 
arch/arm/dts/stm32f746.dtsi +14 -0
index 867f399..431e79c 100644
@@ -117,6 +117,20 @@
 					bias-disable;
 				};
 			};
+			ethernet_mii: mii at 0 {
+				pins {
+					pinmux = <STM32F746_PG13_FUNC_ETH_MII_TXD0_ETH_RMII_TXD0>,
+						 <STM32F746_PG14_FUNC_ETH_MII_TXD1_ETH_RMII_TXD1>,
+						 <STM32F746_PG11_FUNC_ETH_MII_TX_EN_ETH_RMII_TX_EN>,
+						 <STM32F746_PA2_FUNC_ETH_MDIO>,
+						 <STM32F746_PC1_FUNC_ETH_MDC>,
+						 <STM32F746_PA1_FUNC_ETH_MII_RX_CLK_ETH_RMII_REF_CLK>,
+						 <STM32F746_PA7_FUNC_ETH_MII_RX_DV_ETH_RMII_CRS_DV>,
+						 <STM32F746_PC4_FUNC_ETH_MII_RXD0_ETH_RMII_RXD0>,
+						 <STM32F746_PC5_FUNC_ETH_MII_RXD1_ETH_RMII_RXD1>;
+					slew-rate = <2>;
+				};
+			};
 		};
 	};
 };
board/st/stm32f746-disco/stm32f746-disco.c +0 -32
index 9ebc36b..8343f82 100644
@@ -245,48 +245,16 @@ int uart_setup_gpio(void)
 }
 
 #ifdef CONFIG_ETH_DESIGNWARE
-const struct stm32_gpio_ctl gpio_ctl_eth = {
-	.mode = STM32_GPIO_MODE_AF,
-	.otype = STM32_GPIO_OTYPE_PP,
-	.speed = STM32_GPIO_SPEED_100M,
-	.pupd = STM32_GPIO_PUPD_NO,
-	.af = STM32_GPIO_AF11
-};
-
-static const struct stm32_gpio_dsc eth_gpio[] = {
-	{STM32_GPIO_PORT_A, STM32_GPIO_PIN_1},	/* ETH_RMII_REF_CLK */
-	{STM32_GPIO_PORT_A, STM32_GPIO_PIN_2},	/* ETH_MDIO */
-	{STM32_GPIO_PORT_A, STM32_GPIO_PIN_7},	/* ETH_RMII_CRS_DV */
-
-	{STM32_GPIO_PORT_C, STM32_GPIO_PIN_1},	/* ETH_MDC */
-	{STM32_GPIO_PORT_C, STM32_GPIO_PIN_4},	/* ETH_RMII_RXD0 */
-	{STM32_GPIO_PORT_C, STM32_GPIO_PIN_5},	/* ETH_RMII_RXD1 */
-
-	{STM32_GPIO_PORT_G, STM32_GPIO_PIN_11},	/* ETH_RMII_TX_EN */
-	{STM32_GPIO_PORT_G, STM32_GPIO_PIN_13},	/* ETH_RMII_TXD0 */
-	{STM32_GPIO_PORT_G, STM32_GPIO_PIN_14},	/* ETH_RMII_TXD1 */
-};
 
 static int stmmac_setup(void)
 {
-	int res = 0;
-	int i;
-
 	clock_setup(SYSCFG_CLOCK_CFG);
-
 	/* Set >RMII mode */
 	STM32_SYSCFG->pmc |= SYSCFG_PMC_MII_RMII_SEL;
 
 	clock_setup(GPIO_A_CLOCK_CFG);
 	clock_setup(GPIO_C_CLOCK_CFG);
 	clock_setup(GPIO_G_CLOCK_CFG);
-
-	for (i = 0; i < ARRAY_SIZE(eth_gpio); i++) {
-		res = stm32_gpio_config(&eth_gpio[i], &gpio_ctl_eth);
-		if (res)
-			return res;
-	}
-
 	clock_setup(STMMAC_CLOCK_CFG);
 
 	return 0;
Signature · 1 line
1.9.1
#18 lore raw

PATCH v3 9/10 ARM: DT: stm32f7: add ethernet pin contol node

Quoted 4 lines · Vikas Manocha

It also removes the ethernet pin configuration done during the board initialization.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170317/854b0ffa/attachment.sig>
#19 lore raw

PATCH v3 10/10 ARM: DT: stm32f7: add qspi pin contol node

In reply to Vikas Manocha

It also removes the qspi pin configuration done during the board initialization.

---

Changed in v3: None
Changed in v2: None

 arch/arm/dts/stm32f746-disco.dts           |  1 +
 arch/arm/dts/stm32f746.dtsi                | 11 ++++++++
 board/st/stm32f746-disco/stm32f746-disco.c | 43 ------------------------------
 3 files changed, 12 insertions(+), 43 deletions(-)
arch/arm/dts/stm32f746-disco.dts +1 -0
index 3d6002f..07e0ca7 100644
@@ -93,6 +93,7 @@
 };
 
 &qspi {
+	pinctrl-0 = <&qspi_pins>;
 	status = "okay";
 
 	qflash0: n25q128a {
arch/arm/dts/stm32f746.dtsi +11 -0
index 431e79c..b2b0b5f 100644
@@ -131,6 +131,17 @@
 					slew-rate = <2>;
 				};
 			};
+			qspi_pins: qspi at 0{
+				pins {
+					pinmux = <STM32F746_PB2_FUNC_QUADSPI_CLK>,
+						 <STM32F746_PB6_FUNC_QUADSPI_BK1_NCS>,
+						 <STM32F746_PD11_FUNC_QUADSPI_BK1_IO0>,
+						 <STM32F746_PD12_FUNC_QUADSPI_BK1_IO1>,
+						 <STM32F746_PD13_FUNC_QUADSPI_BK1_IO3>,
+						 <STM32F746_PE2_FUNC_QUADSPI_BK1_IO2>;
+					slew-rate = <2>;
+				};
+			};
 		};
 	};
 };
board/st/stm32f746-disco/stm32f746-disco.c +0 -43

55 lines not on this page · raw message

Signature · 1 line
1.9.1
#20 lore raw

PATCH v3 10/10 ARM: DT: stm32f7: add qspi pin contol node

Quoted 4 lines · Vikas Manocha

It also removes the qspi pin configuration done during the board initialization.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170317/a6774cd3/attachment.sig>
#21 lore raw

v3 cover stm32f7: add clock and pin control drivers

In reply to Vikas Manocha

Hi Tom,

If it is ok, please apply this patchset.

Cheers,
Vikas

Quoted 58 lines

-----Original Message-----
From: Vikas MANOCHA
Sent: Sunday, February 12, 2017 10:26 AM
To: u-boot at lists.denx.de
Cc: Vikas MANOCHA <[email protected]>
Subject: [PATCH v3 00/10] stm32f7: add clock and pin control drivers

This patchset:
- adds support for stm32f7 clock driver.
- adds support for stm32f7 pin control driver.
- adds device tree nodes for stm32f7 serial & clock.
- adds stm32f7 pin control device tree sub nodes :
- serial usart1
- ethernet
- qspi flash

Changed in v3:
- remove get length of pin control sub node as not required in case of fdtdec_get_int_array_count

Changed in v2:
- added removed blank lines in code.
- removed not used functions.
- changed fixed length array read from device node to relaxed length read.

Vikas Manocha (10):
serial: stm32f7: add device tree support
clk: stm32f7: add clock driver for stm32f7 family
stm32f7: serial: use clock driver to enable clock
ARM: DT: stm32f7: add usart1 & clock device tree nodes
stm32f7: clk: remove usart1 clock enable from board init
PINCTRL: stm32f7: add pin control driver
ARM: DT: stm32f7: add pin control device node
ARM: DT: stm32f7: add pin control node for serial port pins
ARM: DT: stm32f7: add ethernet pin contol node
ARM: DT: stm32f7: add qspi pin contol node

 arch/arm/dts/stm32f746-disco.dts                   |  13 ++
 arch/arm/dts/stm32f746.dtsi                        |  72 +++++++++++
 arch/arm/mach-stm32/stm32f7/Makefile               |   2 +-
 arch/arm/mach-stm32/stm32f7/soc.c                  |   2 -
 board/st/stm32f746-disco/stm32f746-disco.c         | 111 +----------------
 configs/stm32f746-disco_defconfig                  |   4 +
 doc/device-tree-bindings/clock/st,stm32-rcc.txt    |  95 +++++++++++++++
 .../pinctrl/st,stm32-pinctrl.txt                   | 133 +++++++++++++++++++++
 drivers/clk/Makefile                               |   2 +-
 .../stm32f7/clock.c => drivers/clk/clk_stm32f7.c   |  64 +++++++++-
 drivers/pinctrl/Kconfig                            |   9 ++
 drivers/pinctrl/Makefile                           |   1 +
 drivers/pinctrl/pinctrl_stm32.c                    | 117 ++++++++++++++++++
 drivers/serial/serial_stm32x7.c                    |  42 +++++++
 14 files changed, 548 insertions(+), 119 deletions(-)  create mode 100644 doc/device-tree-bindings/clock/st,stm32-rcc.txt
 create mode 100644 doc/device-tree-bindings/pinctrl/st,stm32-pinctrl.txt
 rename arch/arm/mach-stm32/stm32f7/clock.c => drivers/clk/clk_stm32f7.c (85%)  create mode 100644

drivers/pinctrl/pinctrl_stm32.c

--
1.9.1

#22 lore raw

v3 cover stm32f7: add clock and pin control drivers

Quoted 3 lines · Vikas MANOCHA

Hi Tom,

If it is ok, please apply this patchset.

I'll pick it up early in the next release, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170301/bea47245/attachment.sig>
#23 lore raw

v3 cover stm32f7: add clock and pin control drivers

Thanks Tom,

Quoted 7 lines

-----Original Message-----
From: Tom Rini [mailto:trini at konsulko.com]
Sent: Wednesday, March 01, 2017 7:39 AM
To: Vikas MANOCHA <[email protected]>
Cc: u-boot at lists.denx.de
Subject: Re: [PATCH v3 00/10] stm32f7: add clock and pin control drivers

Quoted 7 lines
Quoted 3 lines · Vikas MANOCHA

Hi Tom,

If it is ok, please apply this patchset.

I'll pick it up early in the next release, thanks!

Ok, great which means wk'11 (week of March 13th), is it right.

I was waiting for this patchset (let us say p1) apply on master before sending another series (let us say p2 : ready at my end for quite some time) applicable on top of p1. In general, is it ok to send the new patchset (e.g. p2) mentioning its dependency (e.g. on p1) or one must have to wait for dependency patches (p1) to be on master.

Cheers,
Vikas

Quoted 3 lines

--
Tom

#24 lore raw

v3 cover stm32f7: add clock and pin control drivers

Quoted 17 lines · Vikas MANOCHA

Thanks Tom,

Quoted 7 lines

-----Original Message-----
From: Tom Rini [mailto:trini at konsulko.com]
Sent: Wednesday, March 01, 2017 7:39 AM
To: Vikas MANOCHA <[email protected]>
Cc: u-boot at lists.denx.de
Subject: Re: [PATCH v3 00/10] stm32f7: add clock and pin control drivers

Quoted 7 lines
Quoted 3 lines · Vikas MANOCHA

Hi Tom,

If it is ok, please apply this patchset.

I'll pick it up early in the next release, thanks!

Quoted 8 lines

Ok, great which means wk'11 (week of March 13th), is it right.

I was waiting for this patchset (let us say p1) apply on master before sending another series (let us say p2 : ready at my end for quite some time) applicable on top of p1.
In general, is it ok to send the new patchset (e.g. p2) mentioning its dependency (e.g. on p1) or one must have to wait for dependency patches (p1) to be on master.

Yes, sending one series that depends on another series is fine, it's just on you to manage those dependencies :) Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170309/c6808380/attachment.sig>
#25 lore raw

v3 cover stm32f7: add clock and pin control drivers

Hi Tom,

Quoted 28 lines

-----Original Message-----
From: Tom Rini [mailto:trini at konsulko.com]
Sent: Thursday, March 09, 2017 8:18 AM
To: Vikas MANOCHA <[email protected]>
Cc: u-boot at lists.denx.de
Subject: Re: [U-Boot] [PATCH v3 00/10] stm32f7: add clock and pin control drivers

Quoted 20 lines · Vikas MANOCHA

Thanks Tom,

Quoted 8 lines

-----Original Message-----
From: Tom Rini [mailto:trini at konsulko.com]
Sent: Wednesday, March 01, 2017 7:39 AM
To: Vikas MANOCHA <[email protected]>
Cc: u-boot at lists.denx.de
Subject: Re: [PATCH v3 00/10] stm32f7: add clock and pin control drivers

Quoted 7 lines
Quoted 3 lines · Vikas MANOCHA

Hi Tom,

If it is ok, please apply this patchset.

I'll pick it up early in the next release, thanks!

Ok, great which means wk'11 (week of March 13th), is it right.

Quoted 8 lines
Quoted 6 lines

I was waiting for this patchset (let us say p1) apply on master before sending another series (let us say p2 : ready at my end for quite some time) applicable on top of p1.
In general, is it ok to send the new patchset (e.g. p2) mentioning its dependency (e.g. on p1) or one must have to wait for dependency patches (p1) to be on master.

Yes, sending one series that depends on another series is fine, it's just on you to manage those dependencies :) Thanks!

Yes sure :-), thanks for this info, appreciate it.

Rgds,
Vikas

Quoted 3 lines

--
Tom

#26 lore raw

v3 cover stm32f7: add clock and pin control drivers

In reply to Tom Rini

Hi,

Just a gentle reminder to pick the series whenever you get time.

Cheers,
Vikas

Quoted 17 lines

-----Original Message-----
From: Tom Rini [mailto:trini at konsulko.com]
Sent: Wednesday, March 01, 2017 7:39 AM
To: Vikas MANOCHA <[email protected]>
Cc: u-boot at lists.denx.de
Subject: Re: [PATCH v3 00/10] stm32f7: add clock and pin control drivers

Quoted 3 lines · Vikas MANOCHA

Hi Tom,

If it is ok, please apply this patchset.

I'll pick it up early in the next release, thanks!

--
Tom

#27 lore raw

v3 cover stm32f7: add clock and pin control drivers

Quoted 3 lines · Vikas MANOCHA

Hi,

Just a gentle reminder to pick the series whenever you get time.

JFYI https://travis-ci.org/trini/u-boot/builds/212223065 (and the compare... link brings you to
https://github.com/trini/u-boot/compare/e9e3eb0089ac...f9515756b6d7)

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170317/8e284b6a/attachment.sig>
#28 lore raw

v3 cover stm32f7: add clock and pin control drivers

Hi Tim,

Quoted 7 lines

-----Original Message-----
From: Tom Rini [mailto:trini at konsulko.com]
Sent: Friday, March 17, 2017 12:41 PM
To: Vikas MANOCHA <[email protected]>
Cc: u-boot at lists.denx.de
Subject: Re: [PATCH v3 00/10] stm32f7: add clock and pin control drivers

Quoted 8 lines
Quoted 3 lines · Vikas MANOCHA

Hi,

Just a gentle reminder to pick the series whenever you get time.

JFYI https://travis-ci.org/trini/u-boot/builds/212223065 (and the compare... link brings you to
https://github.com/trini/u-boot/compare/e9e3eb0089ac...f9515756b6d7)

Great! Thanks for the links.

Cheers,
Vikas

Quoted 3 lines

--
Tom