]> git.sur5r.net Git - u-boot/commitdiff
stm32f7: dm: add driver model support for sdram
authorVikas Manocha <vikas.manocha@st.com>
Mon, 10 Apr 2017 22:02:52 +0000 (15:02 -0700)
committerTom Rini <trini@konsulko.com>
Mon, 8 May 2017 15:39:02 +0000 (11:39 -0400)
Signed-off-by: Vikas Manocha <vikas.manocha@st.com>
cc: Christophe KERELLO <christophe.kerello@st.com>

drivers/ram/stm32_sdram.c

index 13f896484e6beaa2c96097f22a5e3e196d38c894..67be61f01ac3a58aea8b7449250f25ba16ba6961 100644 (file)
@@ -6,6 +6,8 @@
  */
 
 #include <common.h>
+#include <dm.h>
+#include <ram.h>
 #include <asm/io.h>
 #include <asm/arch/fmc.h>
 #include <asm/arch/stm32.h>
@@ -117,3 +119,32 @@ int stm32_sdram_init(void)
 
        return 0;
 }
+
+static int stm32_fmc_probe(struct udevice *dev)
+{
+       stm32_sdram_init();
+       return 0;
+}
+
+static int stm32_fmc_get_info(struct udevice *dev, struct ram_info *info)
+{
+       info->size = CONFIG_SYS_RAM_SIZE;
+       return 0;
+}
+
+static struct ram_ops stm32_fmc_ops = {
+       .get_info = stm32_fmc_get_info,
+};
+
+static const struct udevice_id stm32_fmc_ids[] = {
+       { .compatible = "st,stm32-fmc" },
+       { }
+};
+
+U_BOOT_DRIVER(stm32_fmc) = {
+       .name = "stm32_fmc",
+       .id = UCLASS_RAM,
+       .of_match = stm32_fmc_ids,
+       .ops = &stm32_fmc_ops,
+       .probe = stm32_fmc_probe,
+};