diff options
author | Vikas Manocha <vikas.manocha@st.com> | 2017-04-10 22:02:52 (GMT) |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2017-05-08 15:39:02 (GMT) |
commit | 910a52ede3d7cf75b3157b9a3ef6f40879a38194 (patch) | |
tree | 61e18707b10c2093dab8fb109e7b7e9776944d16 | |
parent | bf1ae4426b89bd8b3e036e012acc4bc88fec4c6e (diff) | |
download | u-boot-fsl-qoriq-910a52ede3d7cf75b3157b9a3ef6f40879a38194.tar.xz |
stm32f7: dm: add driver model support for sdram
Signed-off-by: Vikas Manocha <vikas.manocha@st.com>
cc: Christophe KERELLO <christophe.kerello@st.com>
-rw-r--r-- | drivers/ram/stm32_sdram.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/ram/stm32_sdram.c b/drivers/ram/stm32_sdram.c index 13f8964..67be61f 100644 --- a/drivers/ram/stm32_sdram.c +++ b/drivers/ram/stm32_sdram.c @@ -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, +}; |