From 910a52ede3d7cf75b3157b9a3ef6f40879a38194 Mon Sep 17 00:00:00 2001 From: Vikas Manocha Date: Mon, 10 Apr 2017 15:02:52 -0700 Subject: [PATCH] stm32f7: dm: add driver model support for sdram Signed-off-by: Vikas Manocha cc: Christophe KERELLO --- drivers/ram/stm32_sdram.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/drivers/ram/stm32_sdram.c b/drivers/ram/stm32_sdram.c index 13f896484e..67be61f01a 100644 --- a/drivers/ram/stm32_sdram.c +++ b/drivers/ram/stm32_sdram.c @@ -6,6 +6,8 @@ */ #include +#include +#include #include #include #include @@ -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, +}; -- 2.39.5