stm32f7: use clock driver to enable sdram controller clock
authorVikas Manocha <vikas.manocha@st.com>
Mon, 10 Apr 2017 22:02:55 +0000 (15:02 -0700)
committerTom Rini <trini@konsulko.com>
Mon, 8 May 2017 15:39:04 +0000 (11:39 -0400)
This patch also removes the sdram/fmc clock enable from board specific
code.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>
cc: Christophe KERELLO <christophe.kerello@st.com>

arch/arm/dts/stm32f746.dtsi
board/st/stm32f746-disco/stm32f746-disco.c
drivers/ram/stm32_sdram.c

index 3707550b039dd27ac381f8216f56d9815b5fa3e4..e9fd6f4e2ef5ceeab88683a7bf6c01ffda91e942 100644 (file)
@@ -74,6 +74,7 @@
                fmc: fmc@A0000000 {
                        compatible = "st,stm32-fmc";
                        reg = <0xA0000000 0x1000>;
+                       clocks = <&rcc 0 64>;
                        u-boot,dm-pre-reloc;
                };
 
index e1113a6989bb05028ce1c035989d792c085b07e8..370db15bea900100dc127322beba9590f34dba62 100644 (file)
@@ -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);
index 67be61f01ac3a58aea8b7449250f25ba16ba6961..67d885572d64ed1f352207f62b3c290f78d9bc6c 100644 (file)
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <clk.h>
 #include <dm.h>
 #include <ram.h>
 #include <asm/io.h>
@@ -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;
 }