stm32f4: Clean references to stm32f4 specific clock control

Following activation of stm32 common clock driver for stm32f4 series
remove references to stm32f4 specific driver.

Change-Id: I372a0ea046007bcb34944d6b2b8880077583b1d3
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
This commit is contained in:
Erwan Gouriou 2017-04-11 11:03:32 +02:00 committed by Kumar Gala
commit 242ed389a3
22 changed files with 13 additions and 1076 deletions

View file

@ -42,9 +42,6 @@ endif #SERIAL
if CLOCK_CONTROL
config CLOCK_CONTROL_STM32F4X
def_bool n
config CLOCK_CONTROL_STM32_CUBE
def_bool y

View file

@ -15,15 +15,6 @@
* Chapter 3.4: Embedded Flash Memory
*/
enum {
STM32F4X_FLASH_LATENCY_0 = 0x0,
STM32F4X_FLASH_LATENCY_1 = 0x1,
STM32F4X_FLASH_LATENCY_2 = 0x2,
STM32F4X_FLASH_LATENCY_3 = 0x3,
STM32F4X_FLASH_LATENCY_4 = 0x4,
STM32F4X_FLASH_LATENCY_5 = 0x5,
};
union __flash_acr {
u32_t val;
struct {
@ -48,102 +39,4 @@ struct stm32f4x_flash {
volatile u32_t optctrl;
};
/**
* @brief setup embedded flash controller
*
* Configure flash access time latency (wait states) depending on
* SYSCLK. This code assumes that we're using a supply voltage of
* 2.7V or higher, for lower voltages this code must be changed.
*
* The following tables show the required latency value required for a
* certain CPU frequency (HCLK) and supply voltage. See the section
* "Relation between CPU clock frequency and Flash memory read time"
* in the reference manual for more information.
*
* Note that the highest frequency might be limited for other reaasons
* than wait states, for example the STM32F405xx is limited to 168MHz
* even with 5 wait states and the highest supply voltage.
*
* STM32F401xx:
*
* LATENCY | 2.7V - 3.6V | 2.4V - 2.7V | 2.1V - 2.4V | 1.8V - 2.1V
* ------- | ----------- | ----------- | ----------- | -----------
* 0 | 30 MHz | 24 MHz | 18 MHz | 16 MHz
* 1 | 60 MHz | 48 MHz | 36 MHz | 32 MHz
* 2 | 84 MHz | 72 MHz | 54 MHz | 48 MHz
* 3 | | 84 MHz | 72 MHz | 64 MHz
* 4 | | | 84 MHz | 80 MHz
* 5 | | | | 84 MHz
*
* STM32F405xx/407xx/415xx/417xx/42xxx/43xxx:
*
* LATENCY | 2.7V - 3.6V | 2.4V - 2.7V | 2.1V - 2.4V | 1.8V - 2.1V
* ------- | ----------- | ----------- | ----------- | -----------
* 0 | 30 MHz | 24 MHz | 22 MHz | 20 MHz
* 1 | 60 MHz | 48 MHz | 44 MHz | 40 MHz
* 2 | 90 MHz | 72 MHz | 66 MHz | 60 MHz
* 3 | 120 MHz | 96 MHz | 88 MHz | 80 MHz
* 4 | 150 MHz | 120 MHz | 110 MHz | 100 MHz
* 5 | 180 MHz | 144 MHz | 132 MHz | 120 MHz
* 6 | | 168 MHz | 154 MHz | 140 MHz
* 7 | | 180 MHz | 176 MHz | 160 MHz
* 8 | | | 180 MHz | 168 MHz
*
* STM32F411x:
*
* LATENCY | 2.7V - 3.6V | 2.4V - 2.7V | 2.1V - 2.4V | 1.7V - 2.1V
* ------- | ----------- | ----------- | ----------- | -----------
* 0 | 30 MHz | 24 MHz | 18 MHz | 16 MHz
* 1 | 64 MHz | 48 MHz | 36 MHz | 32 MHz
* 2 | 90 MHz | 72 MHz | 54 MHz | 48 MHz
* 3 | 100 MHz | 96 MHz | 72 MHz | 64 MHz
* 4 | | 100 MHz | 90 MHz | 80 MHz
* 5 | | | 100 MHz | 96 MHz
* 6 | | | | 100 MHz
*/
static inline void __setup_flash(void)
{
volatile struct stm32f4x_flash *regs;
u32_t tmpreg = 0;
regs = (struct stm32f4x_flash *) FLASH_R_BASE;
if (CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC <= 30000000) {
regs->acr.bit.latency = STM32F4X_FLASH_LATENCY_0;
}
#ifdef CONFIG_SOC_STM32F401XE
else if (CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC <= 60000000) {
regs->acr.bit.latency = STM32F4X_FLASH_LATENCY_1;
} else if (CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC <= 84000000) {
regs->acr.bit.latency = STM32F4X_FLASH_LATENCY_2;
}
#elif CONFIG_SOC_STM32F411XE
else if (CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC <= 64000000) {
regs->acr.bit.latency = STM32F4X_FLASH_LATENCY_1;
} else if (CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC <= 90000000) {
regs->acr.bit.latency = STM32F4X_FLASH_LATENCY_2;
} else if (CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC <= 100000000) {
regs->acr.bit.latency = STM32F4X_FLASH_LATENCY_3;
}
#elif defined(CONFIG_SOC_STM32F407XX) || defined(CONFIG_SOC_STM32F429XX)
else if (CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC <= 60000000) {
regs->acr.bit.latency = STM32F4X_FLASH_LATENCY_1;
} else if (CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC <= 90000000) {
regs->acr.bit.latency = STM32F4X_FLASH_LATENCY_2;
} else if (CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC <= 120000000) {
regs->acr.bit.latency = STM32F4X_FLASH_LATENCY_3;
} else if (CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC <= 150000000) {
regs->acr.bit.latency = STM32F4X_FLASH_LATENCY_4;
} else if (CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC <= 180000000) {
regs->acr.bit.latency = STM32F4X_FLASH_LATENCY_5;
}
#else
#error Flash latency configuration for MCU model is missing
#endif
/* Make sure latency was set */
tmpreg = regs->acr.bit.latency;
}
#endif /* _STM32F4X_FLASHREGISTERS_H_ */

View file

@ -1,159 +0,0 @@
/*
* Copyright (c) 2016 Linaro Limited.
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef _STM32F4X_CLOCK_H_
#define _STM32F4X_CLOCK_H_
/**
* @brief Driver for Reset & Clock Control of STM32F4X family processor.
*
* Based on reference manual:
* RM0368 Reference manual STM32F401xB/C and STM32F401xD/E
* advanced ARM ® -based 32-bit MCUs
*
* Chapter 6. Reset and Clock control (RCC) for STM43F401xB/C and STM32F401xD/E
*/
/* 6.3.1 Clock control register (RCC_CR) */
enum {
STM32F4X_RCC_CFG_PLL_SRC_HSI = 0x0,
STM32F4X_RCC_CFG_PLL_SRC_HSE = 0x1,
};
enum {
STM32F4X_RCC_CFG_SYSCLK_SRC_HSI = 0x0,
STM32F4X_RCC_CFG_SYSCLK_SRC_HSE = 0x1,
STM32F4X_RCC_CFG_SYSCLK_SRC_PLL = 0x2,
};
enum {
STM32F4X_RCC_CFG_PLLP_DIV_2 = 0x0,
STM32F4X_RCC_CFG_PLLP_DIV_4 = 0x1,
STM32F4X_RCC_CFG_PLLP_DIV_6 = 0x2,
STM32F4X_RCC_CFG_PLLP_DIV_8 = 0x3,
};
enum {
STM32F4X_RCC_CFG_HCLK_DIV_0 = 0x0,
STM32F4X_RCC_CFG_HCLK_DIV_2 = 0x4,
STM32F4X_RCC_CFG_HCLK_DIV_4 = 0x5,
STM32F4X_RCC_CFG_HCLK_DIV_8 = 0x6,
STM32F4X_RCC_CFG_HCLK_DIV_16 = 0x7,
};
enum {
STM32F4X_RCC_CFG_SYSCLK_DIV_0 = 0x0,
STM32F4X_RCC_CFG_SYSCLK_DIV_2 = 0x8,
STM32F4X_RCC_CFG_SYSCLK_DIV_4 = 0x9,
STM32F4X_RCC_CFG_SYSCLK_DIV_8 = 0xa,
STM32F4X_RCC_CFG_SYSCLK_DIV_16 = 0xb,
STM32F4X_RCC_CFG_SYSCLK_DIV_64 = 0xc,
STM32F4X_RCC_CFG_SYSCLK_DIV_128 = 0xd,
STM32F4X_RCC_CFG_SYSCLK_DIV_256 = 0xe,
STM32F4X_RCC_CFG_SYSCLK_DIV_512 = 0xf,
};
/**
* @brief Reset and Clock Control
*/
/* Helpers */
enum {
STM32F4X_RCC_APB1ENR_PWREN = 0x10000000U,
};
union __rcc_cr {
u32_t val;
struct {
u32_t hsion :1 __packed;
u32_t hsirdy :1 __packed;
u32_t rsvd__2 :1 __packed;
u32_t hsitrim :5 __packed;
u32_t hsical :8 __packed;
u32_t hseon :1 __packed;
u32_t hserdy :1 __packed;
u32_t hsebyp :1 __packed;
u32_t csson :1 __packed;
u32_t rsvd__20_23 :4 __packed;
u32_t pllon :1 __packed;
u32_t pllrdy :1 __packed;
u32_t plli2son :1 __packed;
u32_t plli2srdy :1 __packed;
u32_t pllsaion :1 __packed;
u32_t pllsairdy :1 __packed;
u32_t rsvd__30_31 :2 __packed;
} bit;
};
union __rcc_pllcfgr {
u32_t val;
struct {
u32_t pllm :6 __packed;
u32_t plln :9 __packed;
u32_t rsvd__15 :1 __packed;
u32_t pllp :2 __packed;
u32_t rsvd__18_21 :4 __packed;
u32_t pllsrc :1 __packed;
u32_t rsvd__23 :1 __packed;
u32_t pllq :4 __packed;
u32_t rsvd__28_31 :4 __packed;
} bit;
};
union __rcc_cfgr {
u32_t val;
struct {
u32_t sw :2 __packed;
u32_t sws :2 __packed;
u32_t hpre :4 __packed;
u32_t rsvd__8_9 :2 __packed;
u32_t ppre1 :3 __packed;
u32_t ppre2 :3 __packed;
u32_t rtcpre :5 __packed;
u32_t mco1 :2 __packed;
u32_t i2sscr :1 __packed;
u32_t mco1pre :3 __packed;
u32_t mco2pre :3 __packed;
u32_t mco2 :2 __packed;
} bit;
};
struct stm32f4x_rcc {
union __rcc_cr cr;
union __rcc_pllcfgr pllcfgr;
union __rcc_cfgr cfgr;
u32_t cir;
u32_t ahb1rstr;
u32_t ahb2rstr;
u32_t ahb3rstr;
u32_t rsvd0;
u32_t apb1rstr;
u32_t apb2rstr;
u32_t rsvd1[2];
u32_t ahb1enr;
u32_t ahb2enr;
u32_t ahb3enr;
u32_t rsvd2;
u32_t apb1enr;
u32_t apb2enr;
u32_t rsvd3[2];
u32_t ahb1lpenr;
u32_t ahb2lpenr;
u32_t ahb3lpenr;
u32_t rsvd4;
u32_t apb1lpenr;
u32_t apb2lpenr;
u32_t rsvd5[2];
u32_t bdcr;
u32_t csr;
u32_t rsvd6[2];
u32_t sscgr;
u32_t plli2scfgr;
u32_t rsvd7;
u32_t dckcfgr;
};
#endif /* _STM32F4X_CLOCK_H_ */

View file

@ -234,17 +234,10 @@ int stm32_gpio_enable_int(int port, int pin)
(struct stm32f4x_syscfg *)SYSCFG_BASE;
volatile union syscfg_exticr *exticr;
struct device *clk = device_get_binding(STM32_CLOCK_CONTROL_NAME);
#ifdef CONFIG_CLOCK_CONTROL_STM32_CUBE
struct stm32_pclken pclken = {
.bus = STM32_CLOCK_BUS_APB2,
.enr = LL_APB2_GRP1_PERIPH_SYSCFG
};
#else
struct stm32f4x_pclken pclken = {
.bus = STM32F4X_CLOCK_BUS_APB2,
.enr = STM32F4X_CLOCK_ENABLE_SYSCFG
};
#endif /* CONFIG_CLOCK_CONTROL_STM32_CUBE */
int shift = 0;
/* Enable SYSCFG clock */

View file

@ -8,7 +8,6 @@
#define _STM32F4_SOC_REGISTERS_H_
/* include register mapping headers */
#include "rcc_registers.h"
#include "flash_registers.h"
#include "gpio_registers.h"