Add DM timer support for STM32 SoCs family
Subsystems (5)
cover Add DM timer support for STM32 SoCs family
From: Patrice Chotard <[email protected]>
Add DM timer support for all STM32F7/F4/H7 SoCs family.
Clock driver for STM32F4/F7 and H7 need to updated to get timer clock rate. Remove all defines or files previously used for timer usage in arch/arm/include/asm/arch-stm32fx and in arch/arm/mach-stm32/stm32fx.
Patrice Chotard (6):
timer: stm32: Add timer support for STM32 SoCs family
clk: clk_stm32f: Fix stm32_clk_get_rate() for timer
clk: clk_stm32h7: Fix stm32_clk_get_rate() for timer
clk: clk_stm32h7: Fix prescaler for Domain 3
ARM: dts: stm32: Add timer support for STM32F7
board: stm32: switch to DM STM32 timer
arch/arm/dts/stm32f7-u-boot.dtsi | 8 ++ arch/arm/dts/stm32f746.dtsi | 7 ++ arch/arm/include/asm/arch-stm32f4/stm32.h | 3 - arch/arm/include/asm/arch-stm32f4/stm32_defs.h | 15 --- arch/arm/include/asm/arch-stm32f7/gpt.h | 53 --------- arch/arm/include/asm/arch-stm32f7/stm32.h | 5 - arch/arm/include/asm/arch-stm32f7/stm32_defs.h | 15 --- arch/arm/include/asm/arch-stm32f7/stm32_periph.h | 4 - arch/arm/mach-stm32/Kconfig | 7 ++ arch/arm/mach-stm32/Makefile | 2 - arch/arm/mach-stm32/stm32f4/Makefile | 11 -- arch/arm/mach-stm32/stm32f4/timer.c | 115 ------------------- arch/arm/mach-stm32/stm32f7/Makefile | 8 -- arch/arm/mach-stm32/stm32f7/timer.c | 113 ------------------- board/st/stm32f746-disco/stm32f746-disco.c | 1 - drivers/clk/clk_stm32f.c | 131 +++++++++++++++------ drivers/clk/clk_stm32h7.c | 109 +++++++++++++++--- drivers/spi/stm32_qspi.c | 1 - drivers/timer/Kconfig | 7 ++ drivers/timer/Makefile | 1 + drivers/timer/stm32_timer.c | 138 +++++++++++++++++++++++ include/configs/stm32h743-disco.h | 3 +- include/configs/stm32h743-eval.h | 3 +- include/stm32_rcc.h | 5 + 24 files changed, 368 insertions(+), 397 deletions(-) delete mode 100644 arch/arm/include/asm/arch-stm32f4/stm32_defs.h delete mode 100644 arch/arm/include/asm/arch-stm32f7/gpt.h delete mode 100644 arch/arm/include/asm/arch-stm32f7/stm32_defs.h delete mode 100644 arch/arm/mach-stm32/stm32f4/Makefile delete mode 100644 arch/arm/mach-stm32/stm32f4/timer.c delete mode 100644 arch/arm/mach-stm32/stm32f7/Makefile delete mode 100644 arch/arm/mach-stm32/stm32f7/timer.c create mode 100644 drivers/timer/stm32_timer.c
Signature · 1 line
1.9.1
PATCH 1/6 timer: stm32: Add timer support for STM32 SoCs family
From: Patrice Chotard <[email protected]>
This timer driver is using GPT Timer (General Purpose Timer) available on all STM32 SOCs family.
This driver can be used on STM32F4/F7 and H7 SoCs family
--- drivers/timer/Kconfig | 7 +++ drivers/timer/Makefile | 1 + drivers/timer/stm32_timer.c | 138 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 146 insertions(+) create mode 100644 drivers/timer/stm32_timer.c
drivers/timer/Kconfig +7 -0
@@ -119,4 +119,11 @@ config ROCKCHIP_TIMER Select this to enable support for the timer found on Rockchip devices. +config STM32_TIMER + bool "STM32 timer support" + depends on TIMER + help + Select this to enable support for the timer found on + STM32 devices. + endmenu
drivers/timer/Makefile +1 -0
@@ -16,3 +16,4 @@ obj-$(CONFIG_AG101P_TIMER) += ag101p_timer.o obj-$(CONFIG_ATCPIT100_TIMER) += atcpit100_timer.o obj-$(CONFIG_ROCKCHIP_TIMER) += rockchip_timer.o obj-$(CONFIG_ATMEL_PIT_TIMER) += atmel_pit_timer.o +obj-$(CONFIG_STM32_TIMER) += stm32_timer.o
drivers/timer/stm32_timer.c new file +138 -0
138 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH 1/6 timer: stm32: Add timer support for STM32 SoCs family
Quoted 7 lines · patrice.chotard at st.com
From: Patrice Chotard <[email protected]>
This timer driver is using GPT Timer (General Purpose Timer) available on all STM32 SOCs family.
This driver can be used on STM32F4/F7 and H7 SoCs familySigned-off-by Patrice Chotard <[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/20180314/aa18a450/attachment.sig>
PATCH 2/6 clk: clk_stm32f: Fix stm32_clk_get_rate() for timer
In reply to patrice.chotard at st.comFrom: Patrice Chotard <[email protected]>
For timer clock, an additionnal prescaler is used which was not taken into account previously.
--- drivers/clk/clk_stm32f.c | 116 ++++++++++++++++++++++++++++++++++++++++------- include/stm32_rcc.h | 5 ++ 2 files changed, 104 insertions(+), 17 deletions(-)
drivers/clk/clk_stm32f.c +99 -17
@@ -63,6 +63,7 @@#define RCC_PLLSAICFGR_PLLSAIQ_4 BIT(26)#define RCC_PLLSAICFGR_PLLSAIR_2 BIT(29) +#define RCC_DCKCFGRX_TIMPRE BIT(24)#define RCC_DCKCFGRX_CK48MSEL BIT(27)#define RCC_DCKCFGRX_SDMMC1SEL BIT(28)#define RCC_DCKCFGR2_SDMMC2SEL BIT(29)
@@ -260,21 +261,88 @@ static unsigned long stm32_clk_pll48clk_rate(struct stm32_clk *priv,return sysclk / pllq; } -static unsigned long stm32_clk_get_rate (struct clk *clk) +static bool stm32_get_timpre (struct stm32_clk *priv) { -struct stm32_clk *priv =dev_get_priv (clk->dev);struct stm32_rcc_regs *regs = priv->base; -u32 sysclk =0 ; -u32 shift =0 ; -u16 pllm, plln, pllp; +u32 val; + +if (priv->info.v2)/*stm32f7 case */ + val =readl (®s->dckcfgr2); +else + val =readl (®s->dckcfgr); +/* get timer prescaler */ +return !!(val &RCC_DCKCFGRX_TIMPRE ); +} + +static u32 stm32_get_hclk_rate (struct stm32_rcc_regs *regs,u32 sysclk) +{ +u8 shift;/* 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 }; + + shift = ahb_psc_table[( + (readl (®s->cfgr) &RCC_CFGR_AHB_PSC_MASK ) + >>RCC_CFGR_HPRE_SHIFT )]; + +return sysclk >> shift; +}; + +static u8 stm32_get_apb_shift (struct stm32_rcc_regs *regs,enum apb apb) +{ +/* Prescaler table lookups for clock computation */ u8 apb_psc_table[8 ] = {0 ,0 ,0 ,0 ,1 ,2 ,3 ,4 }; +if (apb ==APB1 ) +return apb_psc_table[( + (readl (®s->cfgr) &RCC_CFGR_APB1_PSC_MASK ) + >>RCC_CFGR_PPRE1_SHIFT )]; +else /* APB2 */ +return apb_psc_table[( + (readl (®s->cfgr) &RCC_CFGR_APB2_PSC_MASK ) + >>RCC_CFGR_PPRE2_SHIFT )]; +}; + +static u32 stm32_get_timer_rate (struct stm32_clk *priv,u32 sysclk, +enum apb apb) +{ +struct stm32_rcc_regs *regs = priv->base; +u8 shift =stm32_get_apb_shift (regs, apb); + +if (stm32_get_timpre (priv)) +/* +* if APB prescaler is configured to a +* division factor of 1, 2 or 4 +*/ +switch (shift) { +case 0 : +case 1 : +case 2 : +return stm32_get_hclk_rate (regs, sysclk); +default : +return (sysclk >> shift) *4 ; + } +else +/* +* if APB prescaler is configured to a +* division factor of 1 +*/ +if (shift ==0 ) +return sysclk; +else +return (sysclk >> shift) *2 ; +}; + +static ulong stm32_clk_get_rate (struct clk *clk) +{ +struct stm32_clk *priv =dev_get_priv (clk->dev); +struct stm32_rcc_regs *regs = priv->base; +u32 sysclk =0 ; +u16 pllm, plln, pllp; +if ((readl (®s->cfgr) &RCC_CFGR_SWS_MASK ) ==RCC_CFGR_SWS_PLL ) { pllm = (readl (®s->pllcfgr) &RCC_PLLCFGR_PLLM_MASK );
@@ -293,16 +361,24 @@ static unsigned long stm32_clk_get_rate(struct clk *clk)* AHB1, AHB2 and AHB3 */ case STM32F7_AHB1_CLOCK(GPIOA) ... STM32F7_AHB3_CLOCK(QSPI): - shift = ahb_psc_table[( - (readl (®s->cfgr) &RCC_CFGR_AHB_PSC_MASK ) - >>RCC_CFGR_HPRE_SHIFT )]; -return sysclk >>= shift; +return stm32_get_hclk_rate (regs, sysclk);/* 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; +/* For timer clock, an additionnal prescaler is used*/ +switch (clk->id) { +case STM32F7_APB1_CLOCK (TIM2 ): +case STM32F7_APB1_CLOCK (TIM3 ): +case STM32F7_APB1_CLOCK (TIM4 ): +case STM32F7_APB1_CLOCK (TIM5 ): +case STM32F7_APB1_CLOCK (TIM6 ): +case STM32F7_APB1_CLOCK (TIM7 ): +case STM32F7_APB1_CLOCK (TIM12 ): +case STM32F7_APB1_CLOCK (TIM13 ): +case STM32F7_APB1_CLOCK (TIM14 ): +return stm32_get_timer_rate (priv, sysclk,APB1 ); + } +return (sysclk >>stm32_get_apb_shift (regs,APB1 )); +/* APB2 CLOCK */ case STM32F7_APB2_CLOCK(TIM1) ... STM32F7_APB2_CLOCK(LTDC):/*
@@ -325,12 +401,18 @@ static unsigned long stm32_clk_get_rate(struct clk *clk)else return stm32_clk_pll48clk_rate (priv, sysclk);break ; + +/* For timer clock, an additionnal prescaler is used*/ +case STM32F7_APB2_CLOCK (TIM1 ): +case STM32F7_APB2_CLOCK (TIM8 ): +case STM32F7_APB2_CLOCK (TIM9 ): +case STM32F7_APB2_CLOCK (TIM10 ): +case STM32F7_APB2_CLOCK (TIM11 ): +return stm32_get_timer_rate (priv, sysclk,APB2 ); +break ; } +return (sysclk >>stm32_get_apb_shift (regs,APB2 )); - shift = apb_psc_table[( - (readl (®s->cfgr) &RCC_CFGR_APB2_PSC_MASK ) - >>RCC_CFGR_PPRE2_SHIFT )]; -return sysclk >>= shift;default :pr_err ("clock index %ld out of range\n" , clk->id);return -EINVAL ;
include/stm32_rcc.h +5 -0
@@ -45,6 +45,11 @@ enum soc_family { STM32F7, }; +enum apb { +APB1 , +APB2 , +}; +struct stm32_rcc_clk {char *drv_name;enum soc_family soc;
Signature · 1 line
1.9.1
PATCH 2/6 clk: clk_stm32f: Fix stm32_clk_get_rate() for timer
Quoted 6 lines · patrice.chotard at st.com
From: Patrice Chotard <[email protected]>
For timer clock, an additionnal prescaler is used which was not taken into account previously.
Signed-off-by Patrice Chotard <[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/20180314/fe7f1747/attachment.sig>
PATCH 3/6 clk: clk_stm32h7: Fix stm32_clk_get_rate() for timer
In reply to patrice.chotard at st.comFrom: Patrice Chotard <[email protected]>
For timer clock, an additional prescaler is used which was not taken into account previously.
--- drivers/clk/clk_stm32h7.c | 102 ++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 90 insertions(+), 12 deletions(-)
drivers/clk/clk_stm32h7.c +90 -12
@@ -35,6 +35,7 @@ DECLARE_GLOBAL_DATA_PTR;#define RCC_CFGR_SW_CSI 1#define RCC_CFGR_SW_HSE 2#define RCC_CFGR_SW_PLL1 3 +#define RCC_CFGR_TIMPRE BIT(15)#define RCC_PLLCKSELR_PLLSRC_HSI 0#define RCC_PLLCKSELR_PLLSRC_CSI 1
@@ -339,6 +340,11 @@ struct pll_psc sys_pll_psc = { .divr = 2, }; +enum apb { +APB1 , +APB2 , +}; +int configure_clocks (struct udevice *dev) {struct stm32_clk *priv =dev_get_priv (dev);
@@ -562,6 +568,67 @@ static u32 stm32_get_PLL1_rate(struct stm32_rcc_regs *regs,return -EINVAL ; } +static u32 stm32_get_apb_psc (struct stm32_rcc_regs *regs,enum apb apb) +{ +u16 prescaler_table[8 ] = {2 ,4 ,8 ,16 ,64 ,128 ,256 ,512 }; +u32 d2cfgr =readl (®s->d2cfgr); + +if (apb ==APB1 ) { +if (d2cfgr &RCC_D2CFGR_D2PPRE1_DIVIDED ) +/* get D2 domain APB1 prescaler */ +return prescaler_table[ + ((d2cfgr &RCC_D2CFGR_D2PPRE1_DIVIDER ) + >>RCC_D2CFGR_D2PPRE1_SHIFT )]; + }else {/* APB2 */ +if (d2cfgr &RCC_D2CFGR_D2PPRE2_DIVIDED ) +/* get D2 domain APB2 prescaler */ +return prescaler_table[ + ((d2cfgr &RCC_D2CFGR_D2PPRE2_DIVIDER ) + >>RCC_D2CFGR_D2PPRE2_SHIFT )]; + } + +return 1 ; +}; + +static u32 stm32_get_timer_rate (struct stm32_clk *priv,u32 sysclk, +enum apb apb) +{ +struct stm32_rcc_regs *regs = priv->rcc_base; +u32 psc =stm32_get_apb_psc (regs, apb); + +if (readl (®s->cfgr) &RCC_CFGR_TIMPRE ) +/* +* if APB prescaler is configured to a +* division factor of 1, 2 or 4 +*/ +switch (psc) { +case 1 : +case 2 : +case 4 : +return sysclk; +case 8 : +return sysclk /2 ; +case 16 : +return sysclk /4 ; +default : +pr_err ("unexpected prescaler value (%d)\n" , psc); +return 0 ; + } +else +switch (psc) { +case 1 : +return sysclk; +case 2 : +case 4 : +case 8 : +case 16 : +return sysclk / psc; +default : +pr_err ("unexpected prescaler value (%d)\n" , psc); +return 0 ; + } +}; +static ulong stm32_clk_get_rate (struct clk *clk) {struct stm32_clk *priv =dev_get_priv (clk->dev);
@@ -660,31 +727,42 @@ static ulong stm32_clk_get_rate(struct clk *clk)case RCC_APB1LENR :case RCC_APB1HENR : -if (d1cfgr &RCC_D2CFGR_D2PPRE1_DIVIDED ) { -/* get D2 domain APB1 prescaler */ - idx = (d1cfgr &RCC_D2CFGR_D2PPRE1_DIVIDER ) >> -RCC_D2CFGR_D2PPRE1_SHIFT ; - sysclk = sysclk / prescaler_table[idx]; +/* special case for GPT timers */ +switch (clk->id) { +case TIM14_CK : +case TIM13_CK : +case TIM12_CK : +case TIM7_CK : +case TIM6_CK : +case TIM5_CK : +case TIM4_CK : +case TIM3_CK : +case TIM2_CK : +return stm32_get_timer_rate (priv, sysclk,APB1 ); }debug ("%s system clock: freq after APB1 prescaler = %ld\n" , __func__, sysclk); -return sysclk; +return (sysclk /stm32_get_apb_psc (regs,APB1 ));break ;case RCC_APB2ENR : -if (d1cfgr &RCC_D2CFGR_D2PPRE2_DIVIDED ) { -/* get D2 domain APB1 prescaler */ - idx = (d1cfgr &RCC_D2CFGR_D2PPRE2_DIVIDER ) >> -RCC_D2CFGR_D2PPRE2_SHIFT ; - sysclk = sysclk / prescaler_table[idx]; +/* special case for timers */ +switch (clk->id) { +case TIM17_CK : +case TIM16_CK : +case TIM15_CK : +case TIM8_CK : +case TIM1_CK : +return stm32_get_timer_rate (priv, sysclk,APB2 ); }debug ("%s system clock: freq after APB2 prescaler = %ld\n" , __func__, sysclk); -return sysclk; +return (sysclk /stm32_get_apb_psc (regs,APB2 )); +break ;default :
Signature · 1 line
1.9.1
PATCH 3/6 clk: clk_stm32h7: Fix stm32_clk_get_rate() for timer
Quoted 6 lines · patrice.chotard at st.com
From: Patrice Chotard <[email protected]>
For timer clock, an additional prescaler is used which was not taken into account previously.
Signed-off-by Patrice Chotard <[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/20180314/0e14c68f/attachment.sig>
PATCH 4/6 clk: clk_stm32h7: Fix prescaler for Domain 3
In reply to patrice.chotard at st.comFrom: Patrice Chotard <[email protected]>
d1cfgr register was used to calculate the domain 3 prescaler value instead of d3cfgr.
--- drivers/clk/clk_stm32h7.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/clk/clk_stm32h7.c +4 -3
@@ -635,7 +635,7 @@ static ulong stm32_clk_get_rate(struct clk *clk)struct stm32_rcc_regs *regs = priv->rcc_base;ulong sysclk =0 ;u32 gate_offset; -u32 d1cfgr; +u32 d1cfgr, d3cfgr;/* prescaler table lookups for clock computation */ u16 prescaler_table[8 ] = {2 ,4 ,8 ,16 ,64 ,128 ,256 ,512 };u8 source, idx;
@@ -712,9 +712,10 @@ static ulong stm32_clk_get_rate(struct clk *clk)break ;case RCC_APB4ENR : -if (d1cfgr &RCC_D3CFGR_D3PPRE_DIVIDED ) { + d3cfgr =readl (®s->d3cfgr); +if (d3cfgr &RCC_D3CFGR_D3PPRE_DIVIDED ) {/* get D3 domain APB4 prescaler */ - idx = (d1cfgr &RCC_D3CFGR_D3PPRE_DIVIDER ) >> + idx = (d3cfgr &RCC_D3CFGR_D3PPRE_DIVIDER ) >>RCC_D3CFGR_D3PPRE_SHIFT ; sysclk = sysclk / prescaler_table[idx]; }
Signature · 1 line
1.9.1
PATCH 4/6 clk: clk_stm32h7: Fix prescaler for Domain 3
Quoted 6 lines · patrice.chotard at st.com
From: Patrice Chotard <[email protected]>
d1cfgr register was used to calculate the domain 3 prescaler value instead of d3cfgr.
Signed-off-by Patrice Chotard <[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/20180314/dbd99016/attachment.sig>
PATCH 5/6 ARM: dts: stm32: Add timer support for STM32F7
In reply to patrice.chotard at st.comFrom: Patrice Chotard <[email protected]>
Add missing timer node to enable timer5 for STM32F7 SoCs family
--- arch/arm/dts/stm32f7-u-boot.dtsi | 8 ++++++++ arch/arm/dts/stm32f746.dtsi | 7 +++++++ 2 files changed, 15 insertions(+)
arch/arm/dts/stm32f7-u-boot.dtsi +8 -0
@@ -1,3 +1,11 @@ +/{ + soc { + timer5: timer at 40000c00 { + u-boot,dm-pre-reloc; + }; + }; +}; + &pinctrl { usart1_pins_a: usart1 at 0 { u-boot,dm-pre-reloc;
arch/arm/dts/stm32f746.dtsi +7 -0
@@ -323,6 +323,13 @@ pinctrl-names = "default", "opendrain"; max-frequency = <48000000>; }; + + timer5: timer at 40000c00 { + compatible = "st,stm32-timer"; + reg = <0x40000c00 0x400>; + interrupts = <50>; + clocks = <&rcc 0 STM32F7_APB1_CLOCK(TIM5)>; + }; }; };
Signature · 1 line
1.9.1
PATCH 5/6 ARM: dts: stm32: Add timer support for STM32F7
Quoted 5 lines · patrice.chotard at st.com
From: Patrice Chotard <[email protected]>
Add missing timer node to enable timer5 for STM32F7 SoCs family
Signed-off-by Patrice Chotard <[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/20180314/200f76ae/attachment.sig>
PATCH 6/6 board: stm32: switch to DM STM32 timer
In reply to patrice.chotard at st.comFrom: Patrice Chotard <[email protected]>
Use available DM stm32_timer driver instead of dedicated mach-stm32/stm32fx/timer.c.
Remove all defines or files previously used for timer usage in arch/arm/include/asm/arch-stm32fx and in arch/arm/mach-stm32/stm32fx
Enable DM STM32_TIMER for STM32F4/F7 and H7.
--- arch/arm/include/asm/arch-stm32f4/stm32.h | 3 - arch/arm/include/asm/arch-stm32f4/stm32_defs.h | 15 --- arch/arm/include/asm/arch-stm32f7/gpt.h | 53 ----------- arch/arm/include/asm/arch-stm32f7/stm32.h | 5 - arch/arm/include/asm/arch-stm32f7/stm32_defs.h | 15 --- arch/arm/include/asm/arch-stm32f7/stm32_periph.h | 4 - arch/arm/mach-stm32/Kconfig | 7 ++ arch/arm/mach-stm32/Makefile | 2 - arch/arm/mach-stm32/stm32f4/Makefile | 11 --- arch/arm/mach-stm32/stm32f4/timer.c | 115 ----------------------- arch/arm/mach-stm32/stm32f7/Makefile | 8 -- arch/arm/mach-stm32/stm32f7/timer.c | 113 ---------------------- board/st/stm32f746-disco/stm32f746-disco.c | 1 - drivers/clk/clk_stm32f.c | 15 --- drivers/spi/stm32_qspi.c | 1 - include/configs/stm32h743-disco.h | 3 +- include/configs/stm32h743-eval.h | 3 +- 17 files changed, 9 insertions(+), 365 deletions(-) delete mode 100644 arch/arm/include/asm/arch-stm32f4/stm32_defs.h delete mode 100644 arch/arm/include/asm/arch-stm32f7/gpt.h delete mode 100644 arch/arm/include/asm/arch-stm32f7/stm32_defs.h delete mode 100644 arch/arm/mach-stm32/stm32f4/Makefile delete mode 100644 arch/arm/mach-stm32/stm32f4/timer.c delete mode 100644 arch/arm/mach-stm32/stm32f7/Makefile delete mode 100644 arch/arm/mach-stm32/stm32f7/timer.c
arch/arm/include/asm/arch-stm32f4/stm32.h +0 -3
@@ -38,9 +38,6 @@ struct stm32_u_id_regs {#define STM32_U_ID_BASE (STM32_SYSMEM_BASE + 0x7A10)#define STM32_U_ID ((struct stm32_u_id_regs *)STM32_U_ID_BASE) -#define STM32_RCC_BASE (STM32_AHB1PERIPH_BASE + 0x3800) -#define STM32_RCC ((struct stm32_rcc_regs *)STM32_RCC_BASE) -#define FLASH_CNTL_BASE (STM32_AHB1PERIPH_BASE + 0x3C00)static const u32 sect_sz_kb[CONFIG_SYS_MAX_FLASH_SECT ] = {
arch/arm/include/asm/arch-stm32f4/stm32_defs.h deleted +0 -15
@@ -1,15 +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_DEFS_H__ -#define __STM32_DEFS_H__ -#include <asm/arch/stm32_periph.h> - -int clock_setup (enum periph_clock ); - -#endif -
arch/arm/include/asm/arch-stm32f7/gpt.h deleted +0 -53
53 lines not on this page · raw message
arch/arm/include/asm/arch-stm32f7/stm32.h +0 -5
@@ -25,7 +25,6 @@#define AHB2_PERIPH_BASE (PERIPH_BASE + 0x10000000)#define AHB3_PERIPH_BASE (PERIPH_BASE + 0x20000000) -#define TIM2_BASE (APB1_PERIPH_BASE + 0x0000)#define USART2_BASE (APB1_PERIPH_BASE + 0x4400)#define USART3_BASE (APB1_PERIPH_BASE + 0x4800)#define PWR_BASE (APB1_PERIPH_BASE + 0x7000)
@@ -45,7 +44,6 @@#define STM32_GPIOI_BASE (AHB1_PERIPH_BASE + 0x2000)#define STM32_GPIOJ_BASE (AHB1_PERIPH_BASE + 0x2400)#define STM32_GPIOK_BASE (AHB1_PERIPH_BASE + 0x2800) -#define RCC_BASE (AHB1_PERIPH_BASE + 0x3800)#define FLASH_CNTL_BASE (AHB1_PERIPH_BASE + 0x3C00)
@@ -59,9 +57,6 @@ static const u32 sect_sz_kb[CONFIG_SYS_MAX_FLASH_SECT] = {#define STM32_BUS_MASK GENMASK(31, 16) -#define STM32_RCC ((struct stm32_rcc_regs *)RCC_BASE) - -void stm32_flash_latency_cfg (int latency);#endif /* _ASM_ARCH_HARDWARE_H */
arch/arm/include/asm/arch-stm32f7/stm32_defs.h deleted +0 -15
@@ -1,15 +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_DEFS_H__ -#define __STM32_DEFS_H__ -#include <asm/arch/stm32_periph.h> - -int clock_setup (enum periph_clock ); - -#endif -
arch/arm/include/asm/arch-stm32f7/stm32_periph.h +0 -4
@@ -20,8 +20,4 @@ enum periph_id { PERIPH_ID_QUADSPI = 92, }; -enum periph_clock { -TIMER2_CLOCK_CFG , -}; -#endif /* __ASM_ARM_ARCH_PERIPH_H */
arch/arm/mach-stm32/Kconfig +7 -0
@@ -13,6 +13,8 @@ config STM32F4 select STM32_RCC select STM32_RESET select STM32_SERIAL + select STM32_TIMER + select TIMER config STM32F7 bool "stm32f7 family"
@@ -27,6 +29,8 @@ config STM32F7 select STM32_RCC select STM32_RESET select STM32_SERIAL + select STM32_TIMER + select TIMER select SUPPORT_SPL select SPL select SPL_BOARD_INIT
@@ -46,6 +50,7 @@ config STM32F7 select SPL_RAM select SPL_SERIAL_SUPPORT select SPL_SYS_MALLOC_SIMPLE + select SPL_TIMER select SPL_XIP_SUPPORT config STM32H7
@@ -62,7 +67,9 @@ config STM32H7 select STM32_RCC select STM32_RESET select STM32_SERIAL + select STM32_TIMER select SYSCON + select TIMER source "arch/arm/mach-stm32/stm32f4/Kconfig" source "arch/arm/mach-stm32/stm32f7/Kconfig"
arch/arm/mach-stm32/Makefile +0 -2
@@ -5,5 +5,3 @@ # SPDX-License-Identifier: GPL-2.0+ # obj-y += soc.o -obj-$(CONFIG_STM32F4) += stm32f4/ -obj-$(CONFIG_STM32F7) += stm32f7/
arch/arm/mach-stm32/stm32f4/Makefile deleted +0 -11
@@ -1,11 +0,0 @@ -# -# (C) Copyright 2000-2006 -# Wolfgang Denk, DENX Software Engineering, wd at denx.de. -# -# (C) Copyright 2015 -# Kamil Lulko, <[email protected]> -# -# SPDX-License-Identifier: GPL-2.0+ -# - -obj-y += timer.o
arch/arm/mach-stm32/stm32f4/timer.c deleted +0 -115
115 lines not on this page · raw message
arch/arm/mach-stm32/stm32f7/Makefile deleted +0 -8
@@ -1,8 +0,0 @@ -# -# Copyright (C) 2016, STMicroelectronics - All Rights Reserved -# Author(s): Vikas Manocha, <[email protected]> for STMicroelectronics. -# -# SPDX-License-Identifier: GPL-2.0+ -# - -obj-y += timer.o
arch/arm/mach-stm32/stm32f7/timer.c deleted +0 -113
113 lines not on this page · raw message
board/st/stm32f746-disco/stm32f746-disco.c +0 -1
@@ -14,7 +14,6 @@#include <asm/arch/stm32.h> #include <asm/arch/gpio.h> #include <asm/arch/stm32_periph.h> -#include <asm/arch/stm32_defs.h> #include <asm/arch/syscfg.h> #include <asm/gpio.h>
drivers/clk/clk_stm32f.c +0 -15
@@ -87,10 +87,6 @@#define RCC_APB2ENR_SYSCFGEN BIT(14)#define RCC_APB2ENR_SAI1EN BIT(22) -enum periph_clock { -TIMER2_CLOCK_CFG , -}; -static const struct stm32_clk_info stm32f4_clk_info = {/* 180 MHz */ .sys_pll_psc = {
@@ -438,17 +434,6 @@ static int stm32_clk_enable(struct clk *clk)return 0 ; } -void clock_setup (int peripheral) -{ -switch (peripheral) { -case TIMER2_CLOCK_CFG : -setbits_le32 (&STM32_RCC ->apb1enr,RCC_APB1ENR_TIM2EN ); -break ; -default : -break ; - } -} -static int stm32_clk_probe (struct udevice *dev) {struct ofnode_phandle_args args;
drivers/spi/stm32_qspi.c +0 -1
@@ -16,7 +16,6 @@#include <dm.h> #include <errno.h> #include <asm/arch/stm32.h> -#include <asm/arch/stm32_defs.h> #include <clk.h> DECLARE_GLOBAL_DATA_PTR ;
include/configs/stm32h743-disco.h +1 -2
@@ -25,8 +25,7 @@#define CONFIG_ENV_SIZE (8 << 10) -#define CONFIG_SYS_ARCH_TIMER -#define CONFIG_SYS_HZ_CLOCK 250000000 +#define CONFIG_SYS_HZ_CLOCK 1000000#define CONFIG_CMDLINE_TAG #define CONFIG_SETUP_MEMORY_TAGS
include/configs/stm32h743-eval.h +1 -2
@@ -25,8 +25,7 @@#define CONFIG_ENV_SIZE (8 << 10) -#define CONFIG_SYS_ARCH_TIMER -#define CONFIG_SYS_HZ_CLOCK 250000000 +#define CONFIG_SYS_HZ_CLOCK 1000000#define CONFIG_CMDLINE_TAG #define CONFIG_SETUP_MEMORY_TAGS
Signature · 1 line
1.9.1
PATCH 6/6 board: stm32: switch to DM STM32 timer
Quoted 11 lines · patrice.chotard at st.com
From: Patrice Chotard <[email protected]>
Use available DM
stm32_timerdriver instead of dedicatedmach-stm32/stm32fx/timer.c.Remove all defines or files previously used for timer usage in
arch/arm/include/asm/arch-stm32fxand inarch/arm/mach-stm32/stm32fxEnable DM
STM32_TIMERfor STM32F4/F7 and H7.Signed-off-by Patrice Chotard <[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/20180314/09d0ca95/attachment.sig>