Extend clk_stm32f7 driver
Subsystems (7)
cover Extend clk_stm32f7 driver
From: Patrice Chotard <[email protected]>
It's the second step to prepare STM32F4 conversion to driver model and device tree support. STM32F4 and STM32F7 RCC IPs are similar, differences between these 2 SoCs can be managed with different compatible string and allows to use a common clock driver.
This series update the clk_stm32f7 driver :
_ retrieve PWR IP base address from DT instead of using hardcoded value. _ update compatible string to manage differences between STM32F4 and
STM32F7
_ introduce STM32F4 support.
_ enable RCC MFD support which allows reset support for STM32F7/F4. _ add MMC clock configuration for MMC usag for STM32F4/F7. _ migrate some defines/struct to common include/stm32_rcc.h to
factorize code between STM32F4/F7.
Patrice Chotard (11):
ARM: DTS: stm32: add pwrcfg node for stm32f746
clk: stm32f7: retrieve PWR base address from DT
clk: stm32f7: add dedicated STM32F7 compatible string
ARM: DTS: stm32: update rcc compatible for STM32F746
clk: stm32f7: add STM32F4 support
clk: stm32f7: rename clk_stm32f7.c to clk_stm32f.c
clk: stm32fx: migrate define from rcc.h to driver
configs: stm32f746-disco: enable MISC/DM_RESET/STM32_RESET and
STM32_RCC
dm: misc: bind STM32F4/F7 clock from rcc MFD driver
clk: clk_stm32fx: add clock configuration for mmc usage
stm32: migrate clock structs in include/stm32_rcc.h
arch/arm/dts/stm32f7-u-boot.dtsi | 4 +
arch/arm/dts/stm32f746.dtsi | 9 +-
arch/arm/include/asm/arch-stm32f4/stm32.h | 35 ---
arch/arm/include/asm/arch-stm32f4/stm32_pwr.h | 23 ++
arch/arm/include/asm/arch-stm32f7/rcc.h | 31 ---
arch/arm/include/asm/arch-stm32f7/stm32.h | 41 ----
arch/arm/include/asm/arch-stm32f7/stm32_pwr.h | 25 ++
arch/arm/mach-stm32/stm32f4/clock.c | 27 +-
arch/arm/mach-stm32/stm32f4/timer.c | 1 +
arch/arm/mach-stm32/stm32f7/timer.c | 1 +
board/st/stm32f429-discovery/stm32f429-discovery.c | 1 +
configs/stm32f746-disco_defconfig | 4 +
drivers/clk/Kconfig | 8 +
drivers/clk/Makefile | 2 +-
drivers/clk/{clk_stm32f7.c => clk_stm32f.c} | 272 +++++++++++++++------
drivers/misc/stm32_rcc.c | 42 +++-
include/dt-bindings/mfd/stm32f7-rcc.h | 1 +
include/stm32_rcc.h | 91 +++++++
18 files changed, 401 insertions(+), 217 deletions(-)
create mode 100644 arch/arm/include/asm/arch-stm32f4/stm32_pwr.h
delete mode 100644 arch/arm/include/asm/arch-stm32f7/rcc.h
create mode 100644 arch/arm/include/asm/arch-stm32f7/stm32_pwr.h
rename drivers/clk/{clk_stm32f7.c => clk_stm32f.c} (56%)
create mode 100644 include/stm32_rcc.hSignature · 1 line
1.9.1
PATCH 1/11 ARM: DTS: stm32: add pwrcfg node for stm32f746
From: Patrice Chotard <[email protected]>
This node is needed to enable performance mode
when system frequency is set up to 200Mhz.
--- arch/arm/dts/stm32f7-u-boot.dtsi | 4 ++++ arch/arm/dts/stm32f746.dtsi | 7 +++++++ 2 files changed, 11 insertions(+)
arch/arm/dts/stm32f7-u-boot.dtsi +4 -0
@@ -22,3 +22,7 @@ u-boot,dm-pre-reloc; }; }; + +&pwrcfg { + u-boot,dm-pre-reloc; +};
arch/arm/dts/stm32f746.dtsi +7 -0
@@ -99,12 +99,19 @@ status = "disabled"; u-boot,dm-pre-reloc; }; + + pwrcfg: power-config at 58024800 { + compatible = "syscon"; + reg = <0x40007000 0x400>; + }; + rcc: rcc at 40023810 { #reset-cells = <1>; #clock-cells = <2>; compatible = "st,stm32f42xx-rcc", "st,stm32-rcc"; reg = <0x40023800 0x400>; clocks = <&clk_hse>; + st,syscfg = <&pwrcfg>; u-boot,dm-pre-reloc; };
Signature · 1 line
1.9.1
PATCH 1/11 ARM: DTS: stm32: add pwrcfg node for stm32f746
Quoted 7 lines · patrice.chotard at st.com
From: Patrice Chotard <[email protected]>
This node is needed to enable performance mode
when system frequency is set up to 200Mhz.Signed-off-by Patrice Chotard <[email protected]>Reviewed-by Vikas Manocha <[email protected]>
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: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20171130/cda7f435/attachment.sig>
PATCH 2/11 clk: stm32f7: retrieve PWR base address from DT
In reply to patrice.chotard at st.comFrom: Patrice Chotard <[email protected]>
PWR IP is used to enable over-drive feature in order to reach a higher frequency.
Get its base address from DT instead of hard-coded value
--- arch/arm/include/asm/arch-stm32f4/stm32_pwr.h | 23 +++++++++++++++++++ arch/arm/include/asm/arch-stm32f7/stm32.h | 7 ------ arch/arm/include/asm/arch-stm32f7/stm32_pwr.h | 25 +++++++++++++++++++++ drivers/clk/clk_stm32f7.c | 32 ++++++++++++++++++--------- 4 files changed, 69 insertions(+), 18 deletions(-) create mode 100644 arch/arm/include/asm/arch-stm32f4/stm32_pwr.h create mode 100644 arch/arm/include/asm/arch-stm32f7/stm32_pwr.h
arch/arm/include/asm/arch-stm32f4/stm32_pwr.h new file +23 -0
@@ -0,0 +1,23 @@ +/* +* Copyright (C) 2017, STMicroelectronics - All Rights Reserved +* Author(s): Patrice Chotard, <[email protected]> for STMicroelectronics. +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __STM32_PWR_H_ + +/* +* Offsets of some PWR registers +*/ +#define PWR_CR1_ODEN BIT(16) +#define PWR_CR1_ODSWEN BIT(17) +#define PWR_CSR1_ODRDY BIT(16) +#define PWR_CSR1_ODSWRDY BIT(17) + +struct stm32_pwr_regs { +u32 cr1;/* power control register 1 */ +u32 csr1;/* power control/status register 2 */ +}; + +#endif /* __STM32_PWR_H_ */
arch/arm/include/asm/arch-stm32f7/stm32.h +0 -7
@@ -95,13 +95,6 @@ struct stm32_rcc_regs { };#define STM32_RCC ((struct stm32_rcc_regs *)RCC_BASE) -struct stm32_pwr_regs { -u32 cr1;/* power control register 1 */ -u32 csr1;/* power control/status register 2 */ -u32 cr2;/* power control register 2 */ -u32 csr2;/* power control/status register 2 */ -}; -#define STM32_PWR ((struct stm32_pwr_regs *)PWR_BASE)void stm32_flash_latency_cfg (int latency);
arch/arm/include/asm/arch-stm32f7/stm32_pwr.h new file +25 -0
@@ -0,0 +1,25 @@ +/* +* Copyright (C) 2017, STMicroelectronics - All Rights Reserved +* Author(s): Patrice Chotard, <[email protected]> for STMicroelectronics. +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __STM32_PWR_H_ + +/* +* Offsets of some PWR registers +*/ +#define PWR_CR1_ODEN BIT(16) +#define PWR_CR1_ODSWEN BIT(17) +#define PWR_CSR1_ODRDY BIT(16) +#define PWR_CSR1_ODSWRDY BIT(17) + +struct stm32_pwr_regs { +u32 cr1;/* power control register 1 */ +u32 csr1;/* power control/status register 2 */ +u32 cr2;/* power control register 2 */ +u32 csr2;/* power control/status register 2 */ +}; + +#endif /* __STM32_PWR_H_ */
drivers/clk/clk_stm32f7.c +21 -11
@@ -8,10 +8,12 @@#include <common.h> #include <clk-uclass.h> #include <dm.h> +#include <asm/io.h> #include <asm/arch/rcc.h> #include <asm/arch/stm32.h> #include <asm/arch/stm32_periph.h> +#include <asm/arch/stm32_pwr.h> #include <dt-bindings/mfd/stm32f7-rcc.h>
@@ -52,13 +54,6 @@#define RCC_CFGR_PPRE1_SHIFT 10#define RCC_CFGR_PPRE2_SHIFT 13 -/* -* Offsets of some PWR registers -*/ -#define PWR_CR1_ODEN BIT(16) -#define PWR_CR1_ODSWEN BIT(17) -#define PWR_CSR1_ODRDY BIT(16) -#define PWR_CSR1_ODSWRDY BIT(17)struct pll_psc {u8 pll_m;
@@ -88,6 +83,7 @@ struct pll_psc {struct stm32_clk {struct stm32_rcc_regs *base; +struct stm32_pwr_regs *pwr_regs; };#if !defined(CONFIG_STM32_HSE_HZ )
@@ -115,6 +111,7 @@ static int configure_clocks(struct udevice *dev) {struct stm32_clk *priv =dev_get_priv (dev);struct stm32_rcc_regs *regs = priv->base; +struct stm32_pwr_regs *pwr = priv->pwr_regs;/* Reset RCC configuration */ setbits_le32 (®s->cr,RCC_CR_HSION );
@@ -153,14 +150,14 @@ static int configure_clocks(struct udevice *dev)/* Enable high performance mode, System frequency up to 200 MHz */ setbits_le32 (®s->apb1enr,RCC_APB1ENR_PWREN ); -setbits_le32 (&STM32_PWR ->cr1,PWR_CR1_ODEN ); +setbits_le32 (&pwr->cr1,PWR_CR1_ODEN );/* Infinite wait! */ -while (!(readl (&STM32_PWR ->csr1) &PWR_CSR1_ODRDY )) +while (!(readl (&pwr->csr1) &PWR_CSR1_ODRDY )) ;/* Enable the Over-drive switch */ -setbits_le32 (&STM32_PWR ->cr1,PWR_CR1_ODSWEN ); +setbits_le32 (&pwr->cr1,PWR_CR1_ODSWEN );/* Infinite wait! */ -while (!(readl (&STM32_PWR ->csr1) &PWR_CSR1_ODSWRDY )) +while (!(readl (&pwr->csr1) &PWR_CSR1_ODSWRDY )) ;stm32_flash_latency_cfg (5 );
@@ -268,6 +265,9 @@ void clock_setup(int peripheral)static int stm32_clk_probe (struct udevice *dev) { +struct ofnode_phandle_args args; +int err; +debug ("%s: stm32_clk_probe\n" , __func__);struct stm32_clk *priv =dev_get_priv (dev);
@@ -279,6 +279,16 @@ static int stm32_clk_probe(struct udevice *dev) priv->base = (struct stm32_rcc_regs *)addr; + err =dev_read_phandle_with_args (dev,"st,syscfg" ,NULL ,0 ,0 , + &args); +if (err) { +debug ("%s: can't find syscon device (%d)\n" , __func__, + err); +return err; + } + + priv->pwr_regs = (struct stm32_pwr_regs *)ofnode_get_addr (args.node); +configure_clocks (dev);return 0 ;
Signature · 1 line
1.9.1
PATCH 2/11 clk: stm32f7: retrieve PWR base address from DT
Quoted 8 lines · patrice.chotard at st.com
From: Patrice Chotard <[email protected]>
PWR IP is used to enable over-drive feature in order to reach a higher frequency.
Get its base address from DT instead of hard-coded valueSigned-off-by Patrice Chotard <[email protected]>Reviewed-by Vikas Manocha <[email protected]>
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: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20171130/8fd97f8c/attachment.sig>
PATCH 3/11 clk: stm32f7: add dedicated STM32F7 compatible string
In reply to patrice.chotard at st.comFrom: Patrice Chotard <[email protected]>
Add a dedicated stm32f7 compatible string to use clk_stm32f7 driver with both STM32F4 and STM32F7 SoCs.
It will be needed to manage differences between these 2 SoCs.
--- drivers/clk/clk_stm32f7.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/clk_stm32f7.c +1 -0
@@ -319,6 +319,7 @@ static struct clk_ops stm32_clk_ops = {static const struct udevice_id stm32_clk_ids[] = { { .compatible ="st,stm32f42xx-rcc" }, + { .compatible ="st,stm32f746-rcc" }, {} };
Signature · 1 line
1.9.1
PATCH 3/11 clk: stm32f7: add dedicated STM32F7 compatible string
Quoted 8 lines · patrice.chotard at st.com
From: Patrice Chotard <[email protected]>
Add a dedicated stm32f7 compatible string to use
clk_stm32f7driver with both STM32F4 and STM32F7 SoCs.
It will be needed to manage differences between these 2 SoCs.Signed-off-by Patrice Chotard <[email protected]>Reviewed-by Vikas Manocha <[email protected]>
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: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20171130/306f29ac/attachment.sig>
PATCH 4/11 ARM: DTS: stm32: update rcc compatible for STM32F746
In reply to patrice.chotard at st.comFrom: Patrice Chotard <[email protected]>
Align the RCC compatible string with the one used by kernel. It will allow to use the same clock driver for STM32F4 and STM32F7 and to manage the differences between the 2 SoCs
--- arch/arm/dts/stm32f746.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/dts/stm32f746.dtsi +1 -1
@@ -108,7 +108,7 @@ rcc: rcc at 40023810 { #reset-cells = <1>; #clock-cells = <2>; - compatible = "st,stm32f42xx-rcc", "st,stm32-rcc"; + compatible = "st,stm32f746-rcc", "st,stm32-rcc"; reg = <0x40023800 0x400>; clocks = <&clk_hse>; st,syscfg = <&pwrcfg>;
Signature · 1 line
1.9.1
PATCH 4/11 ARM: DTS: stm32: update rcc compatible for STM32F746
Quoted 8 lines · patrice.chotard at st.com
From: Patrice Chotard <[email protected]>
Align the RCC compatible string with the one used by kernel. It will allow to use the same clock driver for STM32F4 and STM32F7 and to manage the differences between the 2 SoCs
Signed-off-by Patrice Chotard <[email protected]>Reviewed-by Vikas Manocha <[email protected]>
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: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20171130/c8238f8d/attachment.sig>
PATCH 5/11 clk: stm32f7: add STM32F4 support
In reply to patrice.chotard at st.comFrom: Patrice Chotard <[email protected]>
STM32F4 and STM32F7 RCC clock IP are very similar. Same driver can be used to managed RCC clock for these 2 SoCs.
Differences between STM32F4 and F7 will be managed using different compatible string :
_ overdrive clock is only supported by STM32F7
_ different sys_pll_psc parameters can be used between STM32F4
and STM32F7.
--- drivers/clk/clk_stm32f7.c | 109 ++++++++++++++++++++++++++++------------------ 1 file changed, 66 insertions(+), 43 deletions(-)
drivers/clk/clk_stm32f7.c +66 -43
@@ -81,37 +81,51 @@ struct pll_psc {#define APB_PSC_8 0x6#define APB_PSC_16 0x7 +struct stm32_clk_info { +struct pll_psc sys_pll_psc; +bool has_overdrive; +}; + +struct stm32_clk_info stm32f4_clk_info = { +/* 180 MHz */ + .sys_pll_psc = { + .pll_m =8 , + .pll_n =360 , + .pll_p =2 , + .pll_q =8 , + .ahb_psc =AHB_PSC_1 , + .apb1_psc =APB_PSC_4 , + .apb2_psc =APB_PSC_2 , + }, + .has_overdrive = false, +}; + +struct stm32_clk_info stm32f7_clk_info = { +/* 200 MHz */ + .sys_pll_psc = { + .pll_m =25 , + .pll_n =400 , + .pll_p =2 , + .pll_q =8 , + .ahb_psc =AHB_PSC_1 , + .apb1_psc =APB_PSC_4 , + .apb2_psc =APB_PSC_2 , + }, + .has_overdrive = true, +}; +struct stm32_clk {struct stm32_rcc_regs *base;struct stm32_pwr_regs *pwr_regs; +struct stm32_clk_info *info; }; -#if !defined(CONFIG_STM32_HSE_HZ ) -#error "CONFIG_STM32_HSE_HZ not defined!" -#else -#if (CONFIG_STM32_HSE_HZ ==25000000 ) -#if (CONFIG_SYS_CLK_FREQ ==200000000 ) -/* 200 MHz */ -struct pll_psc sys_pll_psc = { - .pll_m =25 , - .pll_n =400 , - .pll_p =2 , - .pll_q =8 , - .ahb_psc =AHB_PSC_1 , - .apb1_psc =APB_PSC_4 , - .apb2_psc =APB_PSC_2 -}; -#endif -#else -#error "No PLL/Prescaler configuration for given CONFIG_STM32_HSE_HZ exists" -#endif -#endif -static int configure_clocks (struct udevice *dev) {struct stm32_clk *priv =dev_get_priv (dev);struct stm32_rcc_regs *regs = priv->base;struct stm32_pwr_regs *pwr = priv->pwr_regs; +struct pll_psc sys_pll_psc = priv->info->sys_pll_psc;/* Reset RCC configuration */ setbits_le32 (®s->cr,RCC_CR_HSION );
@@ -148,17 +162,23 @@ static int configure_clocks(struct udevice *dev)while (!(readl (®s->cr) &RCC_CR_PLLRDY )) ; -/* Enable high performance mode, System frequency up to 200 MHz */ setbits_le32 (®s->apb1enr,RCC_APB1ENR_PWREN ); -setbits_le32 (&pwr->cr1,PWR_CR1_ODEN ); -/* Infinite wait! */ -while (!(readl (&pwr->csr1) &PWR_CSR1_ODRDY )) - ; -/* Enable the Over-drive switch */ -setbits_le32 (&pwr->cr1,PWR_CR1_ODSWEN ); -/* Infinite wait! */ -while (!(readl (&pwr->csr1) &PWR_CSR1_ODSWRDY )) - ; + +if (priv->info->has_overdrive) { +/* +* Enable high performance mode +* System frequency up to 200 MHz +*/ +setbits_le32 (&pwr->cr1,PWR_CR1_ODEN ); +/* Infinite wait! */ +while (!(readl (&pwr->csr1) &PWR_CSR1_ODRDY )) + ; +/* Enable the Over-drive switch */ +setbits_le32 (&pwr->cr1,PWR_CR1_ODSWEN ); +/* Infinite wait! */ +while (!(readl (&pwr->csr1) &PWR_CSR1_ODSWRDY )) + ; + }stm32_flash_latency_cfg (5 );clrbits_le32 (®s->cfgr, (RCC_CFGR_SW0 |RCC_CFGR_SW1 ));
@@ -273,22 +293,25 @@ static int stm32_clk_probe(struct udevice *dev)struct stm32_clk *priv =dev_get_priv (dev);fdt_addr_t addr; - addr =devfdt_get_addr (dev); + addr =dev_read_addr (dev);if (addr ==FDT_ADDR_T_NONE )return -EINVAL ; priv->base = (struct stm32_rcc_regs *)addr; - - err =dev_read_phandle_with_args (dev,"st,syscfg" ,NULL ,0 ,0 , - &args); -if (err) { -debug ("%s: can't find syscon device (%d)\n" , __func__, - err); -return err; + priv->info = (struct stm32_clk_info *)dev_get_driver_data (dev); + +if (priv->info->has_overdrive) { + err =dev_read_phandle_with_args (dev,"st,syscfg" ,NULL ,0 ,0 , + &args); +if (err) { +debug ("%s: can't find syscon device (%d)\n" , __func__, + err); +return err; + } + + priv->pwr_regs = (struct stm32_pwr_regs *)ofnode_get_addr (args.node); } - priv->pwr_regs = (struct stm32_pwr_regs *)ofnode_get_addr (args.node); -configure_clocks (dev);return 0 ;
@@ -318,8 +341,8 @@ static struct clk_ops stm32_clk_ops = { };static const struct udevice_id stm32_clk_ids[] = { - { .compatible ="st,stm32f42xx-rcc" }, - { .compatible ="st,stm32f746-rcc" }, + { .compatible ="st,stm32f42xx-rcc" , .data = (ulong)&stm32f4_clk_info}, + { .compatible ="st,stm32f746-rcc" , .data = (ulong)&stm32f7_clk_info}, {} };
Signature · 1 line
1.9.1
PATCH 5/11 clk: stm32f7: add STM32F4 support
Quoted 6 lines · patrice.chotard at st.com
From: Patrice Chotard <[email protected]>
STM32F4 and STM32F7 RCC clock IP are very similar. Same driver can be used to managed RCC clock for these 2 SoCs.
Quoted 8 lines
Differences between STM32F4 and F7 will be managed using different compatible string :
_ overdrive clock is only supported by STM32F7
_ differentsys_pll_pscparameters can be used between STM32F4
and STM32F7.Signed-off-by Patrice Chotard <[email protected]>Reviewed-by Vikas Manocha <[email protected]>
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: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20171130/ad519a5e/attachment.sig>
PATCH 6/11 clk: stm32f7: rename clk_stm32f7.c to clk_stm32f.c
In reply to patrice.chotard at st.comFrom: Patrice Chotard <[email protected]>
Now that clk_stm32f7.c manages clocks for both STM32F4 and F7 SoCs rename it to a more generic clk_stm32f.c
Fix also some checkpatch errors/warnings.
---
drivers/clk/Kconfig | 8 ++++++++
drivers/clk/Makefile | 2 +-
drivers/clk/{clk_stm32f7.c => clk_stm32f.c} | 12 ++++--------
3 files changed, 13 insertions(+), 9 deletions(-)
rename drivers/clk/{clk_stm32f7.c => clk_stm32f.c} (98%)drivers/clk/Kconfig +8 -0
@@ -46,6 +46,14 @@ config CLK_BOSTON help Enable this to support the clocks +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_ZYNQ bool "Enable clock driver support for Zynq" depends on CLK && ARCH_ZYNQ
drivers/clk/Makefile +1 -1
@@ -21,5 +21,5 @@ obj-$(CONFIG_CLK_AT91) += at91/ obj-$(CONFIG_CLK_BCM6345) += clk_bcm6345.o obj-$(CONFIG_CLK_BOSTON) += clk_boston.o obj-$(CONFIG_ARCH_ASPEED) += aspeed/ -obj-$(CONFIG_STM32F7) += clk_stm32f7.o +obj-$(CONFIG_CLK_STM32F) += clk_stm32f.o obj-$(CONFIG_STM32H7) += clk_stm32h7.o
drivers/clk/clk_stm32f.c renamed from drivers/clk/clk_stm32f7.c +4 -8
@@ -197,6 +197,7 @@ static unsigned long stm32_clk_get_rate(struct clk *clk)struct stm32_rcc_regs *regs = priv->base;u32 sysclk =0 ;u32 shift =0 ; +u16 pllm, plln, pllp;/* Prescaler table lookups for clock computation */ u8 ahb_psc_table[16 ] = {0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,1 ,2 ,3 ,4 ,6 ,7 ,8 ,9
@@ -207,7 +208,6 @@ static unsigned long stm32_clk_get_rate(struct clk *clk)if ((readl (®s->cfgr) &RCC_CFGR_SWS_MASK ) ==RCC_CFGR_SWS_PLL ) { -u16 pllm, plln, pllp; pllm = (readl (®s->pllcfgr) &RCC_PLLCFGR_PLLM_MASK ); plln = ((readl (®s->pllcfgr) &RCC_PLLCFGR_PLLN_MASK ) >>RCC_PLLCFGR_PLLN_SHIFT );
@@ -228,25 +228,21 @@ static unsigned long stm32_clk_get_rate(struct clk *clk) (readl (®s->cfgr) &RCC_CFGR_AHB_PSC_MASK ) >> RCC_CFGR_HPRE_SHIFT)];return sysclk >>= shift; -break ;/* APB1 CLOCK */ case STM32F7_APB1_CLOCK(TIM2) ... STM32F7_APB1_CLOCK(UART8): shift = apb_psc_table[( (readl (®s->cfgr) &RCC_CFGR_APB1_PSC_MASK ) >>RCC_CFGR_PPRE1_SHIFT )];return sysclk >>= shift; -break ;/* APB2 CLOCK */ case STM32F7_APB2_CLOCK(TIM1) ... STM32F7_APB2_CLOCK(LTDC): shift = apb_psc_table[( (readl (®s->cfgr) &RCC_CFGR_APB2_PSC_MASK ) >>RCC_CFGR_PPRE2_SHIFT )];return sysclk >>= shift; -break ;default :pr_err ("clock index %ld out of range\n" , clk->id);return -EINVAL ; -break ; } }
@@ -288,7 +284,7 @@ static int stm32_clk_probe(struct udevice *dev)struct ofnode_phandle_args args;int err; -debug ("%s: stm32_clk_probe\n" , __func__); +debug ("%s\n" , __func__);struct stm32_clk *priv =dev_get_priv (dev);fdt_addr_t addr;
@@ -346,8 +342,8 @@ static const struct udevice_id stm32_clk_ids[] = { {} }; -U_BOOT_DRIVER (stm32f7_clk) = { - .name ="stm32f7_clk" , +U_BOOT_DRIVER (stm32fx_clk) = { + .name ="stm32fx_clk" , .id =UCLASS_CLK , .of_match = stm32_clk_ids, .ops = &stm32_clk_ops,
Signature · 1 line
1.9.1
PATCH 6/11 clk: stm32f7: rename clk_stm32f7.c to clk_stm32f.c
Quoted 9 lines · patrice.chotard at st.com
From: Patrice Chotard <[email protected]>
Now that
clk_stm32f7.cmanages clocks for both STM32F4 and F7 SoCs rename it to a more genericclk_stm32f.cFix also some checkpatch errors/warnings.
Signed-off-by Patrice Chotard <[email protected]>Reviewed-by Vikas Manocha <[email protected]>
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: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20171130/b8264937/attachment.sig>
PATCH 7/11 clk: stm32fx: migrate define from rcc.h to driver
In reply to patrice.chotard at st.comFrom: Patrice Chotard <[email protected]>
STM32F4 doesn't get rcc.h file, to avoid compilation issue, migrate RCC related defines from rcc.h to driver file and remove rcc.h file.
--- arch/arm/include/asm/arch-stm32f7/rcc.h | 31 ------------------------------- drivers/clk/clk_stm32f.c | 19 ++++++++++++++++++- 2 files changed, 18 insertions(+), 32 deletions(-) delete mode 100644 arch/arm/include/asm/arch-stm32f7/rcc.h
arch/arm/include/asm/arch-stm32f7/rcc.h deleted +0 -31
@@ -1,31 +0,0 @@ -/* -* Copyright (C) 2016, STMicroelectronics - All Rights Reserved -* Author(s): Vikas Manocha, <[email protected]> for STMicroelectronics. -* -* SPDX-License-Identifier: GPL-2.0+ -*/ - -#ifndef _STM32_RCC_H -#define _STM32_RCC_H - -#include <dt-bindings/mfd/stm32f7-rcc.h> - -/* -* RCC AHB1ENR specific definitions -*/ -#define RCC_AHB1ENR_ETHMAC_EN BIT(25) -#define RCC_AHB1ENR_ETHMAC_TX_EN BIT(26) -#define RCC_AHB1ENR_ETHMAC_RX_EN BIT(27) - -/* -* RCC APB1ENR specific definitions -*/ -#define RCC_APB1ENR_TIM2EN BIT(0) -#define RCC_APB1ENR_PWREN BIT(28) - -/* -* RCC APB2ENR specific definitions -*/ -#define RCC_APB2ENR_SYSCFGEN BIT(14) - -#endif
drivers/clk/clk_stm32f.c +18 -1
@@ -10,7 +10,6 @@#include <dm.h> #include <asm/io.h> -#include <asm/arch/rcc.h> #include <asm/arch/stm32.h> #include <asm/arch/stm32_periph.h> #include <asm/arch/stm32_pwr.h>
@@ -54,6 +53,24 @@#define RCC_CFGR_PPRE1_SHIFT 10#define RCC_CFGR_PPRE2_SHIFT 13 +/* +* RCC AHB1ENR specific definitions +*/ +#define RCC_AHB1ENR_ETHMAC_EN BIT(25) +#define RCC_AHB1ENR_ETHMAC_TX_EN BIT(26) +#define RCC_AHB1ENR_ETHMAC_RX_EN BIT(27) + +/* +* RCC APB1ENR specific definitions +*/ +#define RCC_APB1ENR_TIM2EN BIT(0) +#define RCC_APB1ENR_PWREN BIT(28) + +/* +* RCC APB2ENR specific definitions +*/ +#define RCC_APB2ENR_SYSCFGEN BIT(14) +struct pll_psc {u8 pll_m;
Signature · 1 line
1.9.1
PATCH 7/11 clk: stm32fx: migrate define from rcc.h to driver
Quoted 8 lines · patrice.chotard at st.com
From: Patrice Chotard <[email protected]>
STM32F4 doesn't get
rcc.hfile, to avoid compilation issue, migrate RCC related defines fromrcc.hto driver file and removercc.hfile.Signed-off-by Patrice Chotard <[email protected]>Reviewed-by Vikas Manocha <[email protected]>
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: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20171130/5016e51a/attachment.sig>
PATCH 8/11 configs: stm32f746-disco: enable MISC/DM_RESET/STM32_RESET and STM32_RCC
In reply to patrice.chotard at st.comFrom: Patrice Chotard <[email protected]>
This allows to add rcc MFD support to stm32f746-disco board This rcc MFD driver manages clock and reset for STM32 SoCs family
--- configs/stm32f746-disco_defconfig | 4 ++++ 1 file changed, 4 insertions(+)
configs/stm32f746-disco_defconfig +4 -0
@@ -31,6 +31,8 @@ CONFIG_NET_RANDOM_ETHADDR=y CONFIG_NETCONSOLE=y CONFIG_CLK=y CONFIG_DM_GPIO=y +CONFIG_MISC=y +CONFIG_STM32_RCC=y # CONFIG_MMC is not set CONFIG_MTD=y CONFIG_MTD_NOR_FLASH=y
@@ -44,6 +46,8 @@ CONFIG_PINCTRL=y CONFIG_PINCTRL_STM32=y CONFIG_RAM=y CONFIG_STM32_SDRAM=y +CONFIG_DM_RESET=y +CONFIG_STM32_RESET=y CONFIG_STM32X7_SERIAL=y CONFIG_DM_SPI=y CONFIG_STM32_QSPI=y
Signature · 1 line
1.9.1
PATCH 8/11 configs: stm32f746-disco: enable MISC/DM_RESET/STM32_RESET and STM32_RCC
Quoted 7 lines · patrice.chotard at st.com
From: Patrice Chotard <[email protected]>
This allows to add rcc MFD support to stm32f746-disco board This rcc MFD driver manages clock and reset for STM32 SoCs family
Signed-off-by Patrice Chotard <[email protected]>Reviewed-by Vikas Manocha <[email protected]>
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: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20171130/7e880c32/attachment.sig>
PATCH 9/11 dm: misc: bind STM32F4/F7 clock from rcc MFD driver
In reply to patrice.chotard at st.comFrom: Patrice Chotard <[email protected]>
Like STM32H7, now STM32F4/F7 clock drivers are binded by MFD stm32_rcc driver.
This also allows to add reset support to STM32F4/F7 SoCs family. As Reset driver is not part of SPL supported drivers, don't bind it in case of SPL to avoid that stm32_rcc_bind() returns an error.
--- drivers/clk/clk_stm32f.c | 54 ++++++++++++------------------------------------ drivers/misc/stm32_rcc.c | 42 ++++++++++++++++++++++++++++++++----- include/stm32_rcc.h | 52 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 102 insertions(+), 46 deletions(-) create mode 100644 include/stm32_rcc.h
drivers/clk/clk_stm32f.c +13 -41
@@ -8,6 +8,7 @@#include <common.h> #include <clk-uclass.h> #include <dm.h> +#include <stm32_rcc.h> #include <asm/io.h> #include <asm/arch/stm32.h>
@@ -71,38 +72,6 @@*/ #define RCC_APB2ENR_SYSCFGEN BIT(14) - -struct pll_psc { -u8 pll_m; -u16 pll_n; -u8 pll_p; -u8 pll_q; -u8 ahb_psc; -u8 apb1_psc; -u8 apb2_psc; -}; - -#define AHB_PSC_1 0 -#define AHB_PSC_2 0x8 -#define AHB_PSC_4 0x9 -#define AHB_PSC_8 0xA -#define AHB_PSC_16 0xB -#define AHB_PSC_64 0xC -#define AHB_PSC_128 0xD -#define AHB_PSC_256 0xE -#define AHB_PSC_512 0xF - -#define APB_PSC_1 0 -#define APB_PSC_2 0x4 -#define APB_PSC_4 0x5 -#define APB_PSC_8 0x6 -#define APB_PSC_16 0x7 - -struct stm32_clk_info { -struct pll_psc sys_pll_psc; -bool has_overdrive; -}; -struct stm32_clk_info stm32f4_clk_info = {/* 180 MHz */ .sys_pll_psc = {
@@ -311,7 +280,17 @@ static int stm32_clk_probe(struct udevice *dev)return -EINVAL ; priv->base = (struct stm32_rcc_regs *)addr; - priv->info = (struct stm32_clk_info *)dev_get_driver_data (dev); + +switch (dev_get_driver_data (dev)) { +case STM32F4 : + priv->info = &stm32f4_clk_info; +break ; +case STM32F7 : + priv->info = &stm32f7_clk_info; +break ; +default : +return -EINVAL ; + }if (priv->info->has_overdrive) { err = dev_read_phandle_with_args(dev, "st,syscfg", NULL, 0, 0,
@@ -353,16 +332,9 @@ static struct clk_ops stm32_clk_ops = { .get_rate = stm32_clk_get_rate, }; -static const struct udevice_id stm32_clk_ids[] = { - { .compatible ="st,stm32f42xx-rcc" , .data = (ulong)&stm32f4_clk_info}, - { .compatible ="st,stm32f746-rcc" , .data = (ulong)&stm32f7_clk_info}, - {} -}; -U_BOOT_DRIVER (stm32fx_clk) = { - .name ="stm32fx_clk" , + .name ="stm32fx_rcc_clock" , .id =UCLASS_CLK , - .of_match = stm32_clk_ids, .ops = &stm32_clk_ops, .probe = stm32_clk_probe, .priv_auto_alloc_size =sizeof (struct stm32_clk ),
drivers/misc/stm32_rcc.c +37 -5
68 lines not on this page · raw message
include/stm32_rcc.h new file +52 -0
52 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH 9/11 dm: misc: bind STM32F4/F7 clock from rcc MFD driver
Quoted 10 lines · patrice.chotard at st.com
From: Patrice Chotard <[email protected]>
Like STM32H7, now STM32F4/F7 clock drivers are binded by MFD
stm32_rccdriver.
This also allows to add reset support to STM32F4/F7 SoCs family. As Reset driver is not part of SPL supported drivers, don't bind it in case of SPL to avoid thatstm32_rcc_bind()returns an error.Signed-off-by Patrice Chotard <[email protected]>Reviewed-by Vikas Manocha <[email protected]>
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: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20171130/3e3f452f/attachment.sig>
PATCH 10/11 clk: clk_stm32fx: add clock configuration for mmc usage
In reply to patrice.chotard at st.comFrom: Patrice Chotard <[email protected]>
MMC block needs 48Mhz source clock, for that we choose to select the SAI PLL.
Update also stm32_clock_get_rate() to retrieve the MMC clock source needed in MMC driver.
STM32F4 uses a different RCC variant than STM32F7. For STM32F4 sdmmc clocks bit are located into dckcfgr register whereas there are located into dckcfgr2 registers on STM32F7.
In both registers, bits CK48MSEL and SDMMC1SEL are located at the same position.
--- arch/arm/include/asm/arch-stm32f7/stm32.h | 1 + drivers/clk/clk_stm32f.c | 101 +++++++++++++++++++++++++++++- include/dt-bindings/mfd/stm32f7-rcc.h | 1 + include/stm32_rcc.h | 1 + 4 files changed, 103 insertions(+), 1 deletion(-)
arch/arm/include/asm/arch-stm32f7/stm32.h +1 -0
@@ -92,6 +92,7 @@ struct stm32_rcc_regs {u32 plli2scfgr;/* RCC PLLI2S configuration */ u32 pllsaicfgr;/* PLLSAI configuration */ u32 dckcfgr;/* dedicated clocks configuration register */ +u32 dckcfgr2;/* dedicated clocks configuration register */ };#define STM32_RCC ((struct stm32_rcc_regs *)RCC_BASE)
drivers/clk/clk_stm32f.c +100 -1
163 lines not on this page · raw message
include/dt-bindings/mfd/stm32f7-rcc.h +1 -0
@@ -90,6 +90,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
include/stm32_rcc.h +1 -0
@@ -37,6 +37,7 @@ struct pll_psc {struct stm32_clk_info {struct pll_psc sys_pll_psc;bool has_overdrive; +bool v2; };enum soc_family {
Signature · 1 line
1.9.1
PATCH 10/11 clk: clk_stm32fx: add clock configuration for mmc usage
Quoted 13 lines · patrice.chotard at st.com
From: Patrice Chotard <[email protected]>
MMC block needs 48Mhz source clock, for that we choose to select the SAI PLL.
Update alsostm32_clock_get_rate()to retrieve the MMC clock source needed in MMC driver.STM32F4 uses a different RCC variant than STM32F7. For STM32F4 sdmmc clocks bit are located into dckcfgr register whereas there are located into dckcfgr2 registers on STM32F7.
In both registers, bits CK48MSEL and SDMMC1SEL are located at the same position.
Quoted 3 lines
Signed-off-by Christophe Priouzeau <[email protected]>Signed-off-by Patrice Chotard <[email protected]>Reviewed-by Vikas Manocha <[email protected]>
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: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20171130/711fd25d/attachment.sig>
PATCH 11/11 stm32: migrate clock structs in include/stm32_rcc.h
In reply to patrice.chotard at st.comFrom: Patrice Chotard <[email protected]>
In order to factorize code between STM32F4 and STM32F7 migrate all structs related to RCC clocks in include/stm32_rcc.h
--- arch/arm/include/asm/arch-stm32f4/stm32.h | 35 -------------------- arch/arm/include/asm/arch-stm32f7/stm32.h | 35 -------------------- arch/arm/mach-stm32/stm32f4/clock.c | 27 +-------------- arch/arm/mach-stm32/stm32f4/timer.c | 1 + arch/arm/mach-stm32/stm32f7/timer.c | 1 + board/st/stm32f429-discovery/stm32f429-discovery.c | 1 + include/stm32_rcc.h | 38 ++++++++++++++++++++++ 7 files changed, 42 insertions(+), 96 deletions(-)
arch/arm/include/asm/arch-stm32f4/stm32.h +0 -35
@@ -42,41 +42,6 @@ struct stm32_u_id_regs {u32 u_id_high; }; -struct stm32_rcc_regs { -u32 cr;/* RCC clock control */ -u32 pllcfgr;/* RCC PLL configuration */ -u32 cfgr;/* RCC clock configuration */ -u32 cir;/* RCC clock interrupt */ -u32 ahb1rstr;/* RCC AHB1 peripheral reset */ -u32 ahb2rstr;/* RCC AHB2 peripheral reset */ -u32 ahb3rstr;/* RCC AHB3 peripheral reset */ -u32 rsv0; -u32 apb1rstr;/* RCC APB1 peripheral reset */ -u32 apb2rstr;/* RCC APB2 peripheral reset */ -u32 rsv1[2 ]; -u32 ahb1enr;/* RCC AHB1 peripheral clock enable */ -u32 ahb2enr;/* RCC AHB2 peripheral clock enable */ -u32 ahb3enr;/* RCC AHB3 peripheral clock enable */ -u32 rsv2; -u32 apb1enr;/* RCC APB1 peripheral clock enable */ -u32 apb2enr;/* RCC APB2 peripheral clock enable */ -u32 rsv3[2 ]; -u32 ahb1lpenr;/* RCC AHB1 periph clk enable in low pwr mode */ -u32 ahb2lpenr;/* RCC AHB2 periph clk enable in low pwr mode */ -u32 ahb3lpenr;/* RCC AHB3 periph clk enable in low pwr mode */ -u32 rsv4; -u32 apb1lpenr;/* RCC APB1 periph clk enable in low pwr mode */ -u32 apb2lpenr;/* RCC APB2 periph clk enable in low pwr mode */ -u32 rsv5[2 ]; -u32 bdcr;/* RCC Backup domain control */ -u32 csr;/* RCC clock control & status */ -u32 rsv6[2 ]; -u32 sscgr;/* RCC spread spectrum clock generation */ -u32 plli2scfgr;/* RCC PLLI2S configuration */ -u32 pllsaicfgr; -u32 dckcfgr; -}; -struct stm32_pwr_regs {u32 cr;u32 csr;
arch/arm/include/asm/arch-stm32f7/stm32.h +0 -35
@@ -59,41 +59,6 @@ static const u32 sect_sz_kb[CONFIG_SYS_MAX_FLASH_SECT] = {#define STM32_BUS_MASK GENMASK(31, 16) -struct stm32_rcc_regs { -u32 cr;/* RCC clock control */ -u32 pllcfgr;/* RCC PLL configuration */ -u32 cfgr;/* RCC clock configuration */ -u32 cir;/* RCC clock interrupt */ -u32 ahb1rstr;/* RCC AHB1 peripheral reset */ -u32 ahb2rstr;/* RCC AHB2 peripheral reset */ -u32 ahb3rstr;/* RCC AHB3 peripheral reset */ -u32 rsv0; -u32 apb1rstr;/* RCC APB1 peripheral reset */ -u32 apb2rstr;/* RCC APB2 peripheral reset */ -u32 rsv1[2 ]; -u32 ahb1enr;/* RCC AHB1 peripheral clock enable */ -u32 ahb2enr;/* RCC AHB2 peripheral clock enable */ -u32 ahb3enr;/* RCC AHB3 peripheral clock enable */ -u32 rsv2; -u32 apb1enr;/* RCC APB1 peripheral clock enable */ -u32 apb2enr;/* RCC APB2 peripheral clock enable */ -u32 rsv3[2 ]; -u32 ahb1lpenr;/* RCC AHB1 periph clk enable in low pwr mode */ -u32 ahb2lpenr;/* RCC AHB2 periph clk enable in low pwr mode */ -u32 ahb3lpenr;/* RCC AHB3 periph clk enable in low pwr mode */ -u32 rsv4; -u32 apb1lpenr;/* RCC APB1 periph clk enable in low pwr mode */ -u32 apb2lpenr;/* RCC APB2 periph clk enable in low pwr mode */ -u32 rsv5[2 ]; -u32 bdcr;/* RCC Backup domain control */ -u32 csr;/* RCC clock control & status */ -u32 rsv6[2 ]; -u32 sscgr;/* RCC spread spectrum clock generation */ -u32 plli2scfgr;/* RCC PLLI2S configuration */ -u32 pllsaicfgr;/* PLLSAI configuration */ -u32 dckcfgr;/* dedicated clocks configuration register */ -u32 dckcfgr2;/* dedicated clocks configuration register */ -};#define STM32_RCC ((struct stm32_rcc_regs *)RCC_BASE)
arch/arm/mach-stm32/stm32f4/clock.c +1 -26
@@ -9,6 +9,7 @@*/ #include <common.h> +#include <stm32_rcc.h> #include <asm/io.h> #include <asm/arch/stm32.h> #include <asm/arch/stm32_periph.h>
@@ -81,32 +82,6 @@#define RCC_ENR_GPIO_J_EN (1 << 9)#define RCC_ENR_GPIO_K_EN (1 << 10) -struct pll_psc { -u8 pll_m; -u16 pll_n; -u8 pll_p; -u8 pll_q; -u8 ahb_psc; -u8 apb1_psc; -u8 apb2_psc; -}; - -#define AHB_PSC_1 0 -#define AHB_PSC_2 0x8 -#define AHB_PSC_4 0x9 -#define AHB_PSC_8 0xA -#define AHB_PSC_16 0xB -#define AHB_PSC_64 0xC -#define AHB_PSC_128 0xD -#define AHB_PSC_256 0xE -#define AHB_PSC_512 0xF - -#define APB_PSC_1 0 -#define APB_PSC_2 0x4 -#define APB_PSC_4 0x5 -#define APB_PSC_8 0x6 -#define APB_PSC_16 0x7 -#if !defined(CONFIG_STM32_HSE_HZ )#error "CONFIG_STM32_HSE_HZ not defined!"#else
arch/arm/mach-stm32/stm32f4/timer.c +1 -0
@@ -6,6 +6,7 @@*/ #include <common.h> +#include <stm32_rcc.h> #include <asm/io.h> #include <asm/armv7m.h> #include <asm/arch/stm32.h>
arch/arm/mach-stm32/stm32f7/timer.c +1 -0
@@ -6,6 +6,7 @@*/ #include <common.h> +#include <stm32_rcc.h> #include <asm/io.h> #include <asm/arch/stm32.h> #include <asm/arch/stm32_defs.h>
board/st/stm32f429-discovery/stm32f429-discovery.c +1 -0
@@ -13,6 +13,7 @@#include <common.h> #include <dm.h> +#include <stm32_rcc.h> #include <asm/io.h> #include <asm/armv7m.h> #include <asm/arch/stm32.h>
include/stm32_rcc.h +38 -0
@@ -50,4 +50,42 @@ struct stm32_rcc_clk { enum soc_family soc; }; +struct stm32_rcc_regs { +u32 cr;/* RCC clock control */ +u32 pllcfgr;/* RCC PLL configuration */ +u32 cfgr;/* RCC clock configuration */ +u32 cir;/* RCC clock interrupt */ +u32 ahb1rstr;/* RCC AHB1 peripheral reset */ +u32 ahb2rstr;/* RCC AHB2 peripheral reset */ +u32 ahb3rstr;/* RCC AHB3 peripheral reset */ +u32 rsv0; +u32 apb1rstr;/* RCC APB1 peripheral reset */ +u32 apb2rstr;/* RCC APB2 peripheral reset */ +u32 rsv1[2 ]; +u32 ahb1enr;/* RCC AHB1 peripheral clock enable */ +u32 ahb2enr;/* RCC AHB2 peripheral clock enable */ +u32 ahb3enr;/* RCC AHB3 peripheral clock enable */ +u32 rsv2; +u32 apb1enr;/* RCC APB1 peripheral clock enable */ +u32 apb2enr;/* RCC APB2 peripheral clock enable */ +u32 rsv3[2 ]; +u32 ahb1lpenr;/* RCC AHB1 periph clk enable in low pwr mode */ +u32 ahb2lpenr;/* RCC AHB2 periph clk enable in low pwr mode */ +u32 ahb3lpenr;/* RCC AHB3 periph clk enable in low pwr mode */ +u32 rsv4; +u32 apb1lpenr;/* RCC APB1 periph clk enable in low pwr mode */ +u32 apb2lpenr;/* RCC APB2 periph clk enable in low pwr mode */ +u32 rsv5[2 ]; +u32 bdcr;/* RCC Backup domain control */ +u32 csr;/* RCC clock control & status */ +u32 rsv6[2 ]; +u32 sscgr;/* RCC spread spectrum clock generation */ +u32 plli2scfgr;/* RCC PLLI2S configuration */ +/* below registers are only available on STM32F46x and STM32F7 SoCs*/ +u32 pllsaicfgr;/* PLLSAI configuration */ +u32 dckcfgr;/* dedicated clocks configuration register */ +/* Below registers are only available on STM32F7 SoCs */ +u32 dckcfgr2;/* dedicated clocks configuration register */ +}; +#endif /* __STM32_RCC_H_ */
Signature · 1 line
1.9.1
PATCH 11/11 stm32: migrate clock structs in include/stm32_rcc.h
Quoted 7 lines · patrice.chotard at st.com
From: Patrice Chotard <[email protected]>
In order to factorize code between STM32F4 and STM32F7 migrate all structs related to RCC clocks in
include/stm32_rcc.hSigned-off-by Patrice Chotard <[email protected]>Reviewed-by Vikas Manocha <[email protected]>
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: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20171130/39a9c3a5/attachment.sig>
cover Extend clk_stm32f7 driver
In reply to patrice.chotard at st.comLGTM.
Cheers,
Vikas
Quoted 56 lines · patrice.chotard at st.com
From: Patrice Chotard <[email protected]>
It's the second step to prepare STM32F4 conversion to driver model and device tree support. STM32F4 and STM32F7 RCC IPs are similar, differences between these 2 SoCs can be managed with different compatible string and allows to use a common clock driver.
This series update the
clk_stm32f7driver :
_ retrieve PWR IP base address from DT instead of using hardcoded value. _ update compatible string to manage differences between STM32F4 and
STM32F7
_ introduce STM32F4 support.
_ enable RCC MFD support which allows reset support for STM32F7/F4. _ add MMC clock configuration for MMC usag for STM32F4/F7. _ migrate some defines/struct to commoninclude/stm32_rcc.hto
factorize code between STM32F4/F7.Patrice Chotard (11):
ARM: DTS: stm32: add pwrcfg node for stm32f746
clk: stm32f7: retrieve PWR base address from DT
clk: stm32f7: add dedicated STM32F7 compatible string
ARM: DTS: stm32: update rcc compatible for STM32F746
clk: stm32f7: add STM32F4 support
clk: stm32f7: renameclk_stm32f7.ctoclk_stm32f.c
clk: stm32fx: migrate define fromrcc.hto driver
configs: stm32f746-disco: enable MISC/DM_RESET/STM32_RESET andSTM32_RCCdm: misc: bind STM32F4/F7 clock from rcc MFD driver
clk:clk_stm32fx: add clock configuration for mmc usage
stm32: migrate clock structs ininclude/stm32_rcc.harch/arm/dts/stm32f7-u-boot.dtsi | 4 + arch/arm/dts/stm32f746.dtsi | 9 +- arch/arm/include/asm/arch-stm32f4/stm32.h | 35 --- arch/arm/include/asm/arch-stm32f4/stm32_pwr.h | 23 ++ arch/arm/include/asm/arch-stm32f7/rcc.h | 31 --- arch/arm/include/asm/arch-stm32f7/stm32.h | 41 ---- arch/arm/include/asm/arch-stm32f7/stm32_pwr.h | 25 ++ arch/arm/mach-stm32/stm32f4/clock.c | 27 +- arch/arm/mach-stm32/stm32f4/timer.c | 1 + arch/arm/mach-stm32/stm32f7/timer.c | 1 + board/st/stm32f429-discovery/stm32f429-discovery.c | 1 + configs/stm32f746-disco_defconfig | 4 + drivers/clk/Kconfig | 8 + drivers/clk/Makefile | 2 +- drivers/clk/{clk_stm32f7.c => clk_stm32f.c} | 272 +++++++++++++++------ drivers/misc/stm32_rcc.c | 42 +++- include/dt-bindings/mfd/stm32f7-rcc.h | 1 + include/stm32_rcc.h | 91 +++++++ 18 files changed, 401 insertions(+), 217 deletions(-) create mode 100644 arch/arm/include/asm/arch-stm32f4/stm32_pwr.h delete mode 100644 arch/arm/include/asm/arch-stm32f7/rcc.h create mode 100644 arch/arm/include/asm/arch-stm32f7/stm32_pwr.h rename drivers/clk/{clk_stm32f7.c => clk_stm32f.c} (56%) create mode 100644 include/stm32_rcc.h