From: Vikas Manocha Date: Mon, 10 Apr 2017 22:02:55 +0000 (-0700) Subject: stm32f7: use clock driver to enable sdram controller clock X-Git-Tag: v2017.07-rc1~444 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=d0b24c1aa96729d4d9fee02e2c60fc920068c6c5;p=u-boot stm32f7: use clock driver to enable sdram controller clock This patch also removes the sdram/fmc clock enable from board specific code. Signed-off-by: Vikas Manocha cc: Christophe KERELLO --- diff --git a/arch/arm/dts/stm32f746.dtsi b/arch/arm/dts/stm32f746.dtsi index 3707550b03..e9fd6f4e2e 100644 --- a/arch/arm/dts/stm32f746.dtsi +++ b/arch/arm/dts/stm32f746.dtsi @@ -74,6 +74,7 @@ fmc: fmc@A0000000 { compatible = "st,stm32-fmc"; reg = <0xA0000000 0x1000>; + clocks = <&rcc 0 64>; u-boot,dm-pre-reloc; }; diff --git a/board/st/stm32f746-disco/stm32f746-disco.c b/board/st/stm32f746-disco/stm32f746-disco.c index e1113a6989..370db15bea 100644 --- a/board/st/stm32f746-disco/stm32f746-disco.c +++ b/board/st/stm32f746-disco/stm32f746-disco.c @@ -51,8 +51,6 @@ int dram_init(void) if (rv) return rv; - clock_setup(FMC_CLOCK_CFG); - rv = uclass_get_device(UCLASS_RAM, 0, &dev); if (rv) { debug("DRAM init failed: %d\n", rv); diff --git a/drivers/ram/stm32_sdram.c b/drivers/ram/stm32_sdram.c index 67be61f01a..67d885572d 100644 --- a/drivers/ram/stm32_sdram.c +++ b/drivers/ram/stm32_sdram.c @@ -6,6 +6,7 @@ */ #include +#include #include #include #include @@ -122,6 +123,20 @@ int stm32_sdram_init(void) static int stm32_fmc_probe(struct udevice *dev) { +#ifdef CONFIG_CLK + int ret; + struct clk clk; + ret = clk_get_by_index(dev, 0, &clk); + if (ret < 0) + return ret; + + ret = clk_enable(&clk); + + if (ret) { + dev_err(dev, "failed to enable clock\n"); + return ret; + } +#endif stm32_sdram_init(); return 0; }