stm32f7: add clock and pin control drivers
Subsystems (5)
v2 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 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 | 121 +++++++++++++++++++ drivers/serial/serial_stm32x7.c | 42 +++++++ 14 files changed, 552 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
PATCH v2 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 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
@@ -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
@@ -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
PATCH v2 2/10 clk: stm32f7: add clock driver for stm32f7 family
In reply to Vikas Manochaadd basic clock driver support for stm32f7 to enable clocks required by the peripherals.
---
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
@@ -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
@@ -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
@@ -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
@@ -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
PATCH v2 2/10 clk: stm32f7: add clock driver for stm32f7 family
Quoted 12 lines · Vikas Manocha
add basic clock driver support for stm32f7 to enable clocks required by the peripherals.
Signed-off-by Vikas Manocha <[email protected]>---
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.
Quoted 9 lines
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%)
Adding this back:
PATCH v2 2/10 clk: stm32f7: add clock driver for stm32f7 family
Hi Simon,
Quoted 35 lines
-----Original Message-----
From: sjg at google.com [mailto:sjg at google.com] On Behalf Of Simon Glass
Sent: Saturday, February 11, 2017 12:20 PM
To: Vikas MANOCHA <[email protected]>
Cc: U-Boot Mailing List <[email protected]>; Albert Aribaud <[email protected]>; Heiko St?bner <[email protected]>; Joe Hershberger <[email protected]>; Kever Yang <[email protected]>; Masahiro Yamada <[email protected]>; maxims at google.com; Michael Kurz <[email protected]>; Paul Burton <[email protected]>; Stephen Warren <[email protected]>; Thomas Abraham <[email protected]>; Tom Warren <[email protected]>; Toshifumi NISHINAGA <[email protected]>
Subject: Re: [PATCH v2 02/10] clk: stm32f7: add clock driver for stm32f7 familyQuoted 21 lines · Vikas Manocha
add basic clock driver support for stm32f7 to enable clocks required by the peripherals.
Signed-off-by Vikas Manocha <[email protected]>---
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 =>Quoted 1 line
drivers/clk/clk_stm32f7.c(86%)
Quoted 3 lines
Adding this back:
Reviewed-by Simon Glass <[email protected]>
Missed it adding in v2, I will add it in v3 for this patch & others also.
Cheers,
Vikas
PATCH v2 3/10 stm32f7: serial: use clock driver to enable clock
In reply to Vikas Manocha---
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
@@ -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
PATCH v2 3/10 stm32f7: serial: use clock driver to enable clock
Quoted 10 lines · Vikas Manocha
Signed-off-by Vikas Manocha <[email protected]>---
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(+)
Adding this back:
PATCH v2 4/10 ARM: DT: stm32f7: add usart1 & clock device tree nodes
In reply to Vikas ManochaAlso created alias for usart1 and specified oscillator clock for stm32f7 discovery board.
---
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
@@ -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
@@ -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
PATCH v2 5/10 stm32f7: clk: remove usart1 clock enable from board init
In reply to Vikas ManochaBefore 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 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
@@ -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
@@ -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
PATCH v2 6/10 PINCTRL: stm32f7: add pin control driver
In reply to Vikas ManochaThis 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 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 | 121 +++++++++++++++++++ 5 files changed, 267 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
@@ -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
@@ -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
@@ -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 +121 -0
121 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v2 6/10 PINCTRL: stm32f7: add pin control driver
Quoted 5 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.
Signed-off-by Vikas Manocha <[email protected]>
(if you add that to the patch I don't need to remember whether I reviewed it or not)
Quoted 7 lines
---
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.
Quoted 4 lines
configs/stm32f746-disco_defconfig | 3 + .../pinctrl/st,stm32-pinctrl.txt | 133
+++++++++++++++++++++
Quoted 3 lines
drivers/pinctrl/Kconfig | 9 ++ drivers/pinctrl/Makefile | 1 + drivers/pinctrl/pinctrl_stm32.c | 121
+++++++++++++++++++
Quoted 4 lines
5 files changed, 267 insertions(+) create mode 100644 doc/device-tree-bindings/pinctrl/st,stm32-pinctrl.txt create mode 100644 drivers/pinctrl/pinctrl_stm32.c
[...]
drivers/pinctrl/pinctrl_stm32.c
Quoted 9 lines
drivers/pinctrl/pinctrl_stm32.c new file +9
-0+static int stm32_pinctrl_set_state_simple (struct udevice *dev, +struct udevice *periph) +{ +u32 pin_mux[50 ]; +struct fdtdec_phandle_args args; +int rv, len; + +/* Get node pinctrl-0 */ + rv = fdtdec_parse_phandle_with_args(gd->fdt_blob,
periph->of_offset,
drivers/pinctrl/pinctrl_stm32.c
Quoted 5 lines
drivers/pinctrl/pinctrl_stm32.c new file +5
-0+ "pinctrl-0", 0, 0, 0, &args); +if (rv) +return rv; +/* +* check for "pinmux" property in each subnode (e.g. pins1 and
pins2 for
drivers/pinctrl/pinctrl_stm32.c
Quoted 9 lines
drivers/pinctrl/pinctrl_stm32.c new file +9
-0+* usart1) of pin controller phandle "pinctrl-0" +* */ +fdt_for_each_subnode (args.node, gd->fdt_blob, args.node) { +struct stm32_gpio_dsc gpio_dsc; +struct stm32_gpio_ctl gpio_ctl; +int i; + +/* +* just to get the length of "pinmux" to allocate correct
size
drivers/pinctrl/pinctrl_stm32.c line 88
Quoted 7 lines
drivers/pinctrl/pinctrl_stm32.c new file +7
-0+* or memory +* */ +fdt_get_property (gd->fdt_blob, args.node,"pinmux" , &len); + len /=4 ; +debug ("%s: no of pinmux entries= %d\n" , __func__, len); + len =fdtdec_get_int_array_count (gd->fdt_blob, args.node, +"pinmux" , pin_mux, len);
Just to be clear, instead of those 5 lines, you should be able to do:
len = fdtdec_get_int_array_count(gd->fdt_blob, args.node,
"pinmux", pin_mux,ARRAY_SIZE(pin_mux));
drivers/pinctrl/pinctrl_stm32.c line 90
Quoted 2 lines
drivers/pinctrl/pinctrl_stm32.c new file +2
-0+if (len <0 ) +return -EINVAL ;
[..]
Regards,
Simon
PATCH v2 7/10 ARM: DT: stm32f7: add pin control device node
In reply to Vikas Manocha---
Changed in v2: None
arch/arm/dts/stm32f746.dtsi | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
arch/arm/dts/stm32f746.dtsi +8 -1
@@ -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
PATCH v2 8/10 ARM: DT: stm32f7: add pin control node for serial port pins
In reply to Vikas ManochaAnd remove the uart pin configuration from board initialization.
---
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
@@ -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
@@ -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
@@ -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
PATCH v2 9/10 ARM: DT: stm32f7: add ethernet pin contol node
In reply to Vikas ManochaIt also removes the ethernet pin configuration done during the board initialization.
---
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
@@ -78,6 +78,7 @@ &mac { status = "okay"; + pinctrl-0 = <ðernet_mii>; phy-mode = "rmii"; phy-handle = <&phy0>;
arch/arm/dts/stm32f746.dtsi +14 -0
@@ -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
@@ -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 (ð_gpio[i], &gpio_ctl_eth); -if (res) -return res; - } -clock_setup (STMMAC_CLOCK_CFG );return 0 ;
Signature · 1 line
1.9.1
PATCH v2 10/10 ARM: DT: stm32f7: add qspi pin contol node
In reply to Vikas ManochaIt also removes the qspi pin configuration done during the board initialization.
---
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
@@ -93,6 +93,7 @@ }; &qspi { + pinctrl-0 = <&qspi_pins>; status = "okay"; qflash0: n25q128a {
arch/arm/dts/stm32f746.dtsi +11 -0
@@ -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