[PATCH v3 0/3] 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/20220316131000.9874-1-gabriel.ferna...
(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%)

Add a directory in drivers/clk to regroup the clock drivers for all STM32 SoCs with CONFIG_ARCH_STM32 (MCUs with Cortex-M) or CONFIG_ARCH_STM32MP (MPUs with Cortex-A).
Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com Reviewed-by: Grzegorz Szymaszek gszymaszek@short.pl Reviewed-by: Patrice Chotard patrice.chotard@foss.st.com ---
Changes in v3: - Some nits in commit message (s/Soc/SoCs/ & s/cortex /Cortex-/)
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%)
diff --git a/MAINTAINERS b/MAINTAINERS index 56be0bfad0..3f37edd716 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -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 diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig index a62b81a123..fd9e1a80c6 100644 --- a/drivers/clk/Kconfig +++ b/drivers/clk/Kconfig @@ -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" diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile index f5b553172c..c274cda77c 100644 --- a/drivers/clk/Makefile +++ b/drivers/clk/Makefile @@ -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 diff --git a/drivers/clk/stm32/Kconfig b/drivers/clk/stm32/Kconfig new file mode 100644 index 0000000000..eac3fc1e9d --- /dev/null +++ b/drivers/clk/stm32/Kconfig @@ -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. diff --git a/drivers/clk/stm32/Makefile b/drivers/clk/stm32/Makefile new file mode 100644 index 0000000000..f66f295403 --- /dev/null +++ b/drivers/clk/stm32/Makefile @@ -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 diff --git a/drivers/clk/clk_stm32f.c b/drivers/clk/stm32/clk-stm32f.c similarity index 100% rename from drivers/clk/clk_stm32f.c rename to drivers/clk/stm32/clk-stm32f.c diff --git a/drivers/clk/clk_stm32h7.c b/drivers/clk/stm32/clk-stm32h7.c similarity index 100% rename from drivers/clk/clk_stm32h7.c rename to drivers/clk/stm32/clk-stm32h7.c diff --git a/drivers/clk/clk_stm32mp1.c b/drivers/clk/stm32/clk-stm32mp1.c similarity index 100% rename from drivers/clk/clk_stm32mp1.c rename to drivers/clk/stm32/clk-stm32mp1.c

Hi,
On 6/2/22 15:05, Patrick Delaunay wrote:
Add a directory in drivers/clk to regroup the clock drivers for all STM32 SoCs with CONFIG_ARCH_STM32 (MCUs with Cortex-M) or CONFIG_ARCH_STM32MP (MPUs with Cortex-A).
Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com Reviewed-by: Grzegorz Szymaszek gszymaszek@short.pl Reviewed-by: Patrice Chotard patrice.chotard@foss.st.com
Changes in v3:
- Some nits in commit message (s/Soc/SoCs/ & s/cortex /Cortex-/)
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%)
Applied to u-boot-stm/next, thanks!
Regards Patrick

Add the MISC RCC driver for STM32MP13, and bind it to the RCC reset driver, required for initial support.
Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com Reviewed-by: Patrice Chotard patrice.chotard@foss.st.com ---
(no changes since v1)
drivers/misc/stm32_rcc.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/drivers/misc/stm32_rcc.c b/drivers/misc/stm32_rcc.c index f14d6e26d9..b816503bfa 100644 --- a/drivers/misc/stm32_rcc.c +++ b/drivers/misc/stm32_rcc.c @@ -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 }, { } };

Hi,
On 6/2/22 15:05, Patrick Delaunay wrote:
Add the MISC RCC driver for STM32MP13, and bind it to the RCC reset driver, required for initial support.
Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com Reviewed-by: Patrice Chotard patrice.chotard@foss.st.com
(no changes since v1)
drivers/misc/stm32_rcc.c | 6 ++++++ 1 file changed, 6 insertions(+)
Applied to u-boot-stm/next, thanks!
Regards Patrick

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 patrick.delaunay@foss.st.com Reviewed-by: Patrice Chotard patrice.chotard@foss.st.com ---
(no changes since v1)
arch/arm/dts/stm32mp13-u-boot.dtsi | 4 ++++ arch/arm/dts/stm32mp131.dtsi | 7 +++++++ 2 files changed, 11 insertions(+)
diff --git a/arch/arm/dts/stm32mp13-u-boot.dtsi b/arch/arm/dts/stm32mp13-u-boot.dtsi index 1b5b358690..126f282816 100644 --- a/arch/arm/dts/stm32mp13-u-boot.dtsi +++ b/arch/arm/dts/stm32mp13-u-boot.dtsi @@ -86,6 +86,10 @@ u-boot,dm-pre-reloc; };
+&rcc { + u-boot,dm-pre-reloc; +}; + &syscfg { u-boot,dm-pre-reloc; }; diff --git a/arch/arm/dts/stm32mp131.dtsi b/arch/arm/dts/stm32mp131.dtsi index 950e172e45..fcb0af09b5 100644 --- a/arch/arm/dts/stm32mp131.dtsi +++ b/arch/arm/dts/stm32mp131.dtsi @@ -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;

Hi,
On 6/2/22 15:05, Patrick Delaunay wrote:
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 patrick.delaunay@foss.st.com Reviewed-by: Patrice Chotard patrice.chotard@foss.st.com
(no changes since v1)
arch/arm/dts/stm32mp13-u-boot.dtsi | 4 ++++ arch/arm/dts/stm32mp131.dtsi | 7 +++++++ 2 files changed, 11 insertions(+)
This patch is no more needed, it is dropped until final RCC clock driver support
to avoid a probe issue on STM32MP13F-DK board :
stm32-rcc rcc@50000000: Cannot find driver 'stm32mp13_clk'
Patrick

On 6/2/22 9:05 AM, Patrick Delaunay wrote:
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/20220316131000.9874-1-gabriel.ferna...
(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%)
For this series:
Acked-by: Sean Anderson seanga2@gmail.com
participants (3)
-
Patrick DELAUNAY
-
Patrick Delaunay
-
Sean Anderson