]> git.ipfire.org Git - people/ms/u-boot.git/blame - drivers/ram/sandbox_ram.c
dm: core: Add a function to look up a uclass by name
[people/ms/u-boot.git] / drivers / ram / sandbox_ram.c
CommitLineData
64ce0cad
SG
1/*
2 * Copyright (c) 2015 Google, Inc
3 * Written by Simon Glass <sjg@chromium.org>
4 *
5 * SPDX-License-Identifier: GPL-2.0+
6 */
7
8#include <common.h>
9#include <dm.h>
10#include <errno.h>
11#include <ram.h>
12#include <asm/test.h>
13
14DECLARE_GLOBAL_DATA_PTR;
15
16static int sandbox_get_info(struct udevice *dev, struct ram_info *info)
17{
18 info->base = 0;
19 info->size = gd->ram_size;
20
21 return 0;
22}
23
24static const struct ram_ops sandbox_ram_ops = {
25 .get_info = sandbox_get_info,
26};
27
28static const struct udevice_id sandbox_ram_ids[] = {
29 { .compatible = "sandbox,ram" },
30 { }
31};
32
33U_BOOT_DRIVER(warm_ram_sandbox) = {
34 .name = "ram_sandbox",
35 .id = UCLASS_RAM,
36 .of_match = sandbox_ram_ids,
37 .ops = &sandbox_ram_ops,
38};