stm32mp: prepare RCC support for STM32MP13
Subsystems (4)
v2 cover stm32mp: prepare RCC support for STM32MP13
Prepare the support of STM32MP13 RCC, the reset and clock controller
- update of the RCC MISC driver to bind the correct clock and reset driver
- reset driver, same than STM32MP15x = drivers/reset/stm32-reset.c
- clock driver, add a stm32 sub directory to prepare the addition of stm32mp13 drivers named "stm32mp13_clk";
the stm32mp1 driver is only required for STM32MP15x family
- Add RCC node in SOC device tree with the needed tag u-boot,dm-pre-reloc property
This serie is only a preliminary step for STM32MP13 clock and reset support in U-Boot, based on Linux kernel binding [1];
It prepares the next device tree alignment with Linux kernel and simplify the review of the serie with addition of STMP13 clock driver based on CCF and on SCMI clocks provided by OP-TEE, with files
- drivers/clk/stm32/clk-stm32mp13.c
- drivers/clk/stm32/clk-stm32-core.c
In the V2, I remove the addition of a dummy stm32mp13 clock driver:
[2/4] clk: stm32mp13: add a STM32MP13 RCC clock driver
[1] Introduction of STM32MP13 RCC driver (Reset Clock Controller)
https://lore.kernel.org/linux-arm-kernel/[email protected]/
(no changes since v1)
Patrick Delaunay (3):
clk: Add directory for STM32 clock drivers
misc: stm32mp13: introduce STM32MP13 RCC driver
ARM: dts: stm32: add rcc node for STM32MP13
MAINTAINERS | 2 +-
arch/arm/dts/stm32mp13-u-boot.dtsi | 4 ++++
arch/arm/dts/stm32mp131.dtsi | 7 ++++++
drivers/clk/Kconfig | 17 +-------------
drivers/clk/Makefile | 5 ++--
drivers/clk/stm32/Kconfig | 23 +++++++++++++++++++
drivers/clk/stm32/Makefile | 7 ++++++
.../clk/{clk_stm32f.c => stm32/clk-stm32f.c} | 0
.../{clk_stm32h7.c => stm32/clk-stm32h7.c} | 0
.../{clk_stm32mp1.c => stm32/clk-stm32mp1.c} | 0
drivers/misc/stm32_rcc.c | 6 +++++
11 files changed, 51 insertions(+), 20 deletions(-)
create mode 100644 drivers/clk/stm32/Kconfig
create mode 100644 drivers/clk/stm32/Makefile
rename drivers/clk/{clk_stm32f.c => stm32/clk-stm32f.c} (100%)
rename drivers/clk/{clk_stm32h7.c => stm32/clk-stm32h7.c} (100%)
rename drivers/clk/{clk_stm32mp1.c => stm32/clk-stm32mp1.c} (100%)Signature · 1 line
2.25.1
PATCH v2 1/3 clk: Add directory for STM32 clock drivers
Add a directory in drivers/clk to regroup the clock drivers for all STM32 Soc with CONFIG_ARCH_STM32 (MCUs with cortex M) or CONFIG_ARCH_STM32MP (MPUs with cortex A).
---
Changes in v2:
- replace '_' by '-' in file names to be consistant with other clk drivers and prepare introduction of new files for stm32mp13
MAINTAINERS | 2 +-
drivers/clk/Kconfig | 17 +-------------
drivers/clk/Makefile | 5 ++--
drivers/clk/stm32/Kconfig | 23 +++++++++++++++++++
drivers/clk/stm32/Makefile | 7 ++++++
.../clk/{clk_stm32f.c => stm32/clk-stm32f.c} | 0
.../{clk_stm32h7.c => stm32/clk-stm32h7.c} | 0
.../{clk_stm32mp1.c => stm32/clk-stm32mp1.c} | 0
8 files changed, 34 insertions(+), 20 deletions(-)
create mode 100644 drivers/clk/stm32/Kconfig
create mode 100644 drivers/clk/stm32/Makefile
rename drivers/clk/{clk_stm32f.c => stm32/clk-stm32f.c} (100%)
rename drivers/clk/{clk_stm32h7.c => stm32/clk-stm32h7.c} (100%)
rename drivers/clk/{clk_stm32mp1.c => stm32/clk-stm32mp1.c} (100%)MAINTAINERS +1 -1
@@ -469,7 +469,7 @@ S: Maintained F: arch/arm/mach-stm32mp/ F: doc/board/st/ F: drivers/adc/stm32-adc* -F: drivers/clk/clk_stm32mp1.c +F: drivers/clk/stm32/ F: drivers/gpio/stm32_gpio.c F: drivers/hwspinlock/stm32_hwspinlock.c F: drivers/i2c/stm32f7_i2c.c
drivers/clk/Kconfig +1 -16
@@ -166,22 +166,6 @@ config CLK_SCMI by a SCMI agent based on SCMI clock protocol communication with a SCMI server. -config CLK_STM32F - bool "Enable clock driver support for STM32F family" - depends on CLK && (STM32F7 || STM32F4) - default y - help - This clock driver adds support for RCC clock management - for STM32F4 and STM32F7 SoCs. - -config CLK_STM32MP1 - bool "Enable RCC clock driver for STM32MP1" - depends on ARCH_STM32MP && CLK - default y - help - Enable the STM32 clock (RCC) driver. Enable support for - manipulating STM32MP1's on-SoC clocks. - config CLK_HSDK bool "Enable cgu clock driver for HSDK boards" depends on CLK && TARGET_HSDK
@@ -251,6 +235,7 @@ source "drivers/clk/owl/Kconfig" source "drivers/clk/renesas/Kconfig" source "drivers/clk/sunxi/Kconfig" source "drivers/clk/sifive/Kconfig" +source "drivers/clk/stm32/Kconfig" source "drivers/clk/tegra/Kconfig" source "drivers/clk/ti/Kconfig" source "drivers/clk/uniphier/Kconfig"
drivers/clk/Makefile +2 -3
@@ -23,6 +23,8 @@ obj-$(CONFIG_ARCH_MTMIPS) += mtmips/ obj-$(CONFIG_ARCH_NPCM) += nuvoton/ obj-$(CONFIG_ARCH_ROCKCHIP) += rockchip/ obj-$(CONFIG_ARCH_SOCFPGA) += altera/ +obj-$(CONFIG_ARCH_STM32) += stm32/ +obj-$(CONFIG_ARCH_STM32MP) += stm32/ obj-$(CONFIG_ARCH_SUNXI) += sunxi/ obj-$(CONFIG_CLK_AT91) += at91/ obj-$(CONFIG_CLK_BCM6345) += clk_bcm6345.o
@@ -39,8 +41,6 @@ obj-$(CONFIG_CLK_OWL) += owl/ obj-$(CONFIG_CLK_RENESAS) += renesas/ obj-$(CONFIG_CLK_SCMI) += clk_scmi.o obj-$(CONFIG_CLK_SIFIVE) += sifive/ -obj-$(CONFIG_CLK_STM32F) += clk_stm32f.o -obj-$(CONFIG_CLK_STM32MP1) += clk_stm32mp1.o obj-$(CONFIG_CLK_UNIPHIER) += uniphier/ obj-$(CONFIG_CLK_VERSACLOCK) += clk_versaclock.o obj-$(CONFIG_CLK_VERSAL) += clk_versal.o
@@ -53,4 +53,3 @@ obj-$(CONFIG_MACH_PIC32) += clk_pic32.o obj-$(CONFIG_SANDBOX_CLK_CCF) += clk_sandbox_ccf.o obj-$(CONFIG_SANDBOX) += clk_sandbox.o obj-$(CONFIG_SANDBOX) += clk_sandbox_test.o -obj-$(CONFIG_STM32H7) += clk_stm32h7.o
drivers/clk/stm32/Kconfig new file +23 -0
@@ -0,0 +1,23 @@ +config CLK_STM32F + bool "Enable clock driver support for STM32F family" + depends on CLK && (STM32F7 || STM32F4) + default y + help + This clock driver adds support for RCC clock management + for STM32F4 and STM32F7 SoCs. + +config CLK_STM32H7 + bool "Enable clock driver support for STM32H7 family" + depends on CLK && STM32H7 + default y + help + This clock driver adds support for RCC clock management + for STM32H7 SoCs. + +config CLK_STM32MP1 + bool "Enable RCC clock driver for STM32MP15" + depends on ARCH_STM32MP && CLK + default y if STM32MP15x + help + Enable the STM32 clock (RCC) driver. Enable support for + manipulating STM32MP15's on-SoC clocks.
drivers/clk/stm32/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Copyright (C) 2022, STMicroelectronics - All Rights Reserved + +obj-$(CONFIG_CLK_STM32F) += clk-stm32f.o +obj-$(CONFIG_CLK_STM32H7) += clk-stm32h7.o +obj-$(CONFIG_CLK_STM32MP1) += clk-stm32mp1.o
drivers/clk/stm32/clk-stm32f.c renamed from drivers/clk/clk_stm32f.c +0 -0
drivers/clk/stm32/clk-stm32h7.c renamed from drivers/clk/clk_stm32h7.c +0 -0
drivers/clk/stm32/clk-stm32mp1.c renamed from drivers/clk/clk_stm32mp1.c +0 -0
Signature · 1 line
2.25.1
Re: [PATCH v2 1/3] clk: Add directory for STM32 clock drivers
Hi Patrick
drivers/clk/stm32/clk-stm32mp1.c
Quoted 155 lines · Patrick Delaunay
Add a directory in
drivers/clkto regroup the clock drivers for all STM32 Soc withCONFIG_ARCH_STM32(MCUs with cortex M) orCONFIG_ARCH_STM32MP(MPUs with cortex A).Signed-off-by Patrick Delaunay <[email protected]>---
Changes in v2:
- replace '_' by '-' in file names to be consistant with other clk drivers and prepare introduction of new files for stm32mp13MAINTAINERS | 2 +- drivers/clk/Kconfig | 17 +------------- drivers/clk/Makefile | 5 ++-- drivers/clk/stm32/Kconfig | 23 +++++++++++++++++++ drivers/clk/stm32/Makefile | 7 ++++++ .../clk/{clk_stm32f.c => stm32/clk-stm32f.c} | 0 .../{clk_stm32h7.c => stm32/clk-stm32h7.c} | 0 .../{clk_stm32mp1.c => stm32/clk-stm32mp1.c} | 0 8 files changed, 34 insertions(+), 20 deletions(-) create mode 100644 drivers/clk/stm32/Kconfig create mode 100644 drivers/clk/stm32/Makefile rename drivers/clk/{clk_stm32f.c => stm32/clk-stm32f.c} (100%) rename drivers/clk/{clk_stm32h7.c => stm32/clk-stm32h7.c} (100%) rename drivers/clk/{clk_stm32mp1.c => stm32/clk-stm32mp1.c} (100%)MAINTAINERS +1
-1@@ -469,7 +469,7 @@ S: Maintained F: arch/arm/mach-stm32mp/ F: doc/board/st/ F: drivers/adc/stm32-adc* -F: drivers/clk/clk_stm32mp1.c +F: drivers/clk/stm32/ F: drivers/gpio/stm32_gpio.c F: drivers/hwspinlock/stm32_hwspinlock.c F: drivers/i2c/stm32f7_i2c.cdrivers/clk/Kconfig +1
-16@@ -166,22 +166,6 @@ config CLK_SCMI by a SCMI agent based on SCMI clock protocol communication with a SCMI server. -config CLK_STM32F - bool "Enable clock driver support for STM32F family" - depends on CLK && (STM32F7 || STM32F4) - default y - help - This clock driver adds support for RCC clock management - for STM32F4 and STM32F7 SoCs. - -config CLK_STM32MP1 - bool "Enable RCC clock driver for STM32MP1" - depends on ARCH_STM32MP && CLK - default y - help - Enable the STM32 clock (RCC) driver. Enable support for - manipulating STM32MP1's on-SoC clocks. - config CLK_HSDK bool "Enable cgu clock driver for HSDK boards" depends on CLK && TARGET_HSDK@@ -251,6 +235,7 @@ source "drivers/clk/owl/Kconfig" source "drivers/clk/renesas/Kconfig" source "drivers/clk/sunxi/Kconfig" source "drivers/clk/sifive/Kconfig" +source "drivers/clk/stm32/Kconfig" source "drivers/clk/tegra/Kconfig" source "drivers/clk/ti/Kconfig" source "drivers/clk/uniphier/Kconfig"drivers/clk/Makefile +2
-3@@ -23,6 +23,8 @@ obj-$(CONFIG_ARCH_MTMIPS) += mtmips/ obj-$(CONFIG_ARCH_NPCM) += nuvoton/ obj-$(CONFIG_ARCH_ROCKCHIP) += rockchip/ obj-$(CONFIG_ARCH_SOCFPGA) += altera/ +obj-$(CONFIG_ARCH_STM32) += stm32/ +obj-$(CONFIG_ARCH_STM32MP) += stm32/ obj-$(CONFIG_ARCH_SUNXI) += sunxi/ obj-$(CONFIG_CLK_AT91) += at91/ obj-$(CONFIG_CLK_BCM6345) += clk_bcm6345.o@@ -39,8 +41,6 @@ obj-$(CONFIG_CLK_OWL) += owl/ obj-$(CONFIG_CLK_RENESAS) += renesas/ obj-$(CONFIG_CLK_SCMI) += clk_scmi.o obj-$(CONFIG_CLK_SIFIVE) += sifive/ -obj-$(CONFIG_CLK_STM32F) += clk_stm32f.o -obj-$(CONFIG_CLK_STM32MP1) += clk_stm32mp1.o obj-$(CONFIG_CLK_UNIPHIER) += uniphier/ obj-$(CONFIG_CLK_VERSACLOCK) += clk_versaclock.o obj-$(CONFIG_CLK_VERSAL) += clk_versal.o@@ -53,4 +53,3 @@ obj-$(CONFIG_MACH_PIC32) += clk_pic32.o obj-$(CONFIG_SANDBOX_CLK_CCF) += clk_sandbox_ccf.o obj-$(CONFIG_SANDBOX) += clk_sandbox.o obj-$(CONFIG_SANDBOX) += clk_sandbox_test.o -obj-$(CONFIG_STM32H7) += clk_stm32h7.odrivers/clk/stm32/Kconfig new file +23
-0@@ -0,0 +1,23 @@ +config CLK_STM32F + bool "Enable clock driver support for STM32F family" + depends on CLK && (STM32F7 || STM32F4) + default y + help + This clock driver adds support for RCC clock management + for STM32F4 and STM32F7 SoCs. + +config CLK_STM32H7 + bool "Enable clock driver support for STM32H7 family" + depends on CLK && STM32H7 + default y + help + This clock driver adds support for RCC clock management + for STM32H7 SoCs. + +config CLK_STM32MP1 + bool "Enable RCC clock driver for STM32MP15" + depends on ARCH_STM32MP && CLK + default y if STM32MP15x + help + Enable the STM32 clock (RCC) driver. Enable support for + manipulating STM32MP15's on-SoC clocks.drivers/clk/stm32/Makefile new file +7
-0@@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Copyright (C) 2022, STMicroelectronics - All Rights Reserved + +obj-$(CONFIG_CLK_STM32F) += clk-stm32f.o +obj-$(CONFIG_CLK_STM32H7) += clk-stm32h7.o +obj-$(CONFIG_CLK_STM32MP1) += clk-stm32mp1.odrivers/clk/stm32/clk-stm32f.c renamed from drivers/clk/clk_stm32f.c +0
-0drivers/clk/stm32/clk-stm32h7.c renamed from drivers/clk/clk_stm32h7.c +0
-0drivers/clk/stm32/clk-stm32mp1.c renamed from drivers/clk/clk_stm32mp1.c +0
-0
Thanks
Patrice
Re: [PATCH v2 1/3] clk: Add directory for STM32 clock drivers
In reply to Patrick DelaunayQuoted 3 lines · Patrick Delaunay
Add a directory in
drivers/clkto regroup the clock drivers for all STM32 Soc withCONFIG_ARCH_STM32(MCUs with cortex M) orCONFIG_ARCH_STM32MP(MPUs with cortex A).
Some nits:
- s/Soc/SoCs/
- s/cortex /Cortex-/
Even if you will not include these two changes, feel free to add:
PATCH v2 2/3 misc: stm32mp13: introduce STM32MP13 RCC driver
In reply to Patrick DelaunayAdd the MISC RCC driver for STM32MP13, and bind it to the RCC reset driver, required for initial support.
---
(no changes since v1)
drivers/misc/stm32_rcc.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/misc/stm32_rcc.c +6 -0
@@ -39,6 +39,11 @@ struct stm32_rcc_clk stm32_rcc_clk_mp1 = { .soc = STM32MP1, }; +struct stm32_rcc_clk stm32_rcc_clk_mp13 = { + .drv_name ="stm32mp13_clk" , + .soc =STM32MP1 , +}; +static int stm32_rcc_bind (struct udevice *dev) {struct udevice *child;
@@ -79,6 +84,7 @@ static const struct udevice_id stm32_rcc_ids[] = { {.compatible = "st,stm32f746-rcc", .data = (ulong)&stm32_rcc_clk_f7 }, {.compatible = "st,stm32h743-rcc", .data = (ulong)&stm32_rcc_clk_h7 }, {.compatible = "st,stm32mp1-rcc", .data = (ulong)&stm32_rcc_clk_mp1 }, + {.compatible = "st,stm32mp13-rcc", .data = (ulong)&stm32_rcc_clk_mp13 }, { } };
Signature · 1 line
2.25.1
Re: [PATCH v2 2/3] misc: stm32mp13: introduce STM32MP13 RCC driver
Hi Patrick
Quoted 28 lines · Patrick Delaunay
Add the MISC RCC driver for STM32MP13, and bind it to the RCC reset driver, required for initial support.
Signed-off-by Patrick Delaunay <[email protected]>---
(no changes since v1)
drivers/misc/stm32_rcc.c | 6 ++++++ 1 file changed, 6 insertions(+)drivers/misc/stm32_rcc.c +5
-0@@ -39,6 +39,11 @@ struct stm32_rcc_clk stm32_rcc_clk_mp1 = { .soc = STM32MP1, }; +struct stm32_rcc_clk stm32_rcc_clk_mp13 = { + .drv_name ="stm32mp13_clk" , + .soc =STM32MP1 , +}; +static int stm32_rcc_bind (struct udevice *dev) {struct udevice *child;
drivers/misc/stm32_rcc.c static const struct udevice_id stm32_rcc_ids[] = { · line 90
Quoted 7 lines
drivers/misc/stm32_rcc.c +1
-0@@ -79,6 +84,7 @@ static const struct udevice_id stm32_rcc_ids[] = { {.compatible = "st,stm32f746-rcc", .data = (ulong)&stm32_rcc_clk_f7 }, {.compatible = "st,stm32h743-rcc", .data = (ulong)&stm32_rcc_clk_h7 }, {.compatible = "st,stm32mp1-rcc", .data = (ulong)&stm32_rcc_clk_mp1 }, + {.compatible = "st,stm32mp13-rcc", .data = (ulong)&stm32_rcc_clk_mp13 }, { } };
Thanks
Patrice
PATCH v2 3/3 ARM: dts: stm32: add rcc node for STM32MP13
In reply to Patrick DelaunayAdd the RCC node, not yet in Linux kernel device tree
to handle the U-Boot RCC drivers with the needed U-Boot property "u-boot,dm-pre-reloc" property as the clock and reset drivers are required during pre-location.
---
(no changes since v1)
arch/arm/dts/stm32mp13-u-boot.dtsi | 4 ++++ arch/arm/dts/stm32mp131.dtsi | 7 +++++++ 2 files changed, 11 insertions(+)
arch/arm/dts/stm32mp13-u-boot.dtsi +4 -0
@@ -86,6 +86,10 @@ u-boot,dm-pre-reloc; }; +&rcc { + u-boot,dm-pre-reloc; +}; + &syscfg { u-boot,dm-pre-reloc; };
arch/arm/dts/stm32mp131.dtsi +7 -0
@@ -159,6 +159,13 @@ dma-channels = <16>; }; + rcc: rcc@50000000 { + compatible = "st,stm32mp13-rcc", "syscon"; + reg = <0x50000000 0x1000>; + #clock-cells = <1>; + #reset-cells = <1>; + }; + exti: interrupt-controller@5000d000 { compatible = "st,stm32mp13-exti", "syscon"; interrupt-controller;
Signature · 1 line
2.25.1
Re: [PATCH v2 3/3] ARM: dts: stm32: add rcc node for STM32MP13
Hi Patrick
Quoted 38 lines · Patrick Delaunay
Add the RCC node, not yet in Linux kernel device tree
to handle the U-Boot RCC drivers with the needed U-Boot property "u-boot,dm-pre-reloc" property as the clock and reset drivers are required during pre-location.Signed-off-by Patrick Delaunay <[email protected]>---
(no changes since v1)
arch/arm/dts/stm32mp13-u-boot.dtsi | 4 ++++ arch/arm/dts/stm32mp131.dtsi | 7 +++++++ 2 files changed, 11 insertions(+)arch/arm/dts/stm32mp13-u-boot.dtsi +4
-0@@ -86,6 +86,10 @@ u-boot,dm-pre-reloc; }; +&rcc { + u-boot,dm-pre-reloc; +}; + &syscfg { u-boot,dm-pre-reloc; };arch/arm/dts/stm32mp131.dtsi +0
-0@@ -159,6 +159,13 @@ dma-channels = <16>; };
arch/arm/dts/stm32mp131.dtsi line 171
Quoted 10 lines
arch/arm/dts/stm32mp131.dtsi +7
-0+ rcc: rcc@50000000 { + compatible = "st,stm32mp13-rcc", "syscon"; + reg = <0x50000000 0x1000>; + #clock-cells = <1>; + #reset-cells = <1>; + }; + exti: interrupt-controller@5000d000 { compatible = "st,stm32mp13-exti", "syscon"; interrupt-controller;
Thanks
Patrice