Commit 9a50acfd authored by Yuri Tikhonov's avatar Yuri Tikhonov
Browse files

RT72064. stm32: access FSMC, RCC in board.c with macros


Signed-off-by: default avatarYuri Tikhonov <yur@emcraft.com>
parent cf7bffda
......@@ -135,12 +135,10 @@ int misc_init_r(void)
*/
int dram_init(void)
{
int rv = 0;
int rv = 0;
#if (CONFIG_NR_DRAM_BANKS > 0)
volatile struct stm32_fsmc_regs *fsmc_regs;
volatile struct stm32_rcc_regs *rcc_regs;
int i;
int i;
/*
* Connect GPIOs to FSMC controller
......@@ -155,25 +153,23 @@ int dram_init(void)
/*
* Enable FSMC interface clock
*/
rcc_regs = (struct stm32_rcc_regs *)STM32_RCC_BASE;
rcc_regs->ahb3enr |= STM32_RCC_ENR_FSMC;
STM32_RCC->ahb3enr |= STM32_RCC_ENR_FSMC;
/*
* Configure FSMC
*/
fsmc_regs = (struct stm32_fsmc_regs *)STM32_FSMC_BASE;
i = CONFIG_SYS_RAM_CS - 1;
/*
* Fake BCR read; if don't do this, then BCR remains configured
* with defaults.
*/
rv = fsmc_regs->cs[i].bcr;
rv = STM32_FSMC->cs[i].bcr;
fsmc_regs->cs[i].bcr = CONFIG_SYS_FSMC_BCR;
fsmc_regs->cs[i].btr = CONFIG_SYS_FSMC_BTR;
STM32_FSMC->cs[i].bcr = CONFIG_SYS_FSMC_BCR;
STM32_FSMC->cs[i].btr = CONFIG_SYS_FSMC_BTR;
#if defined(CONFIG_SYS_FSMC_BWR)
fsmc_regs->wt[i].wtr = CONFIG_SYS_FSMC_BWR;
STM32_FSMC->wt[i].wtr = CONFIG_SYS_FSMC_BWR;
#endif
/*
......
......@@ -116,6 +116,7 @@ struct stm32_fsmc_regs {
* FSMC registers base
*/
#define STM32_FSMC_BASE 0xA0000000
#define STM32_FSMC ((volatile struct stm32_fsmc_regs *)STM32_FSMC_BASE)
/*
* BCR reg fields
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment