Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Simon Glass | 3d355e6 | 2015-07-06 12:54:31 -0600 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (c) 2015 Google, Inc |
| 4 | * Written by Simon Glass <sjg@chromium.org> |
Simon Glass | 3d355e6 | 2015-07-06 12:54:31 -0600 | [diff] [blame] | 5 | */ |
| 6 | |
Simon Glass | 3d355e6 | 2015-07-06 12:54:31 -0600 | [diff] [blame] | 7 | #include <dm.h> |
| 8 | #include <errno.h> |
| 9 | #include <ram.h> |
Simon Glass | 3ba929a | 2020-10-30 21:38:53 -0600 | [diff] [blame] | 10 | #include <asm/global_data.h> |
Simon Glass | 3d355e6 | 2015-07-06 12:54:31 -0600 | [diff] [blame] | 11 | #include <asm/test.h> |
| 12 | |
| 13 | DECLARE_GLOBAL_DATA_PTR; |
| 14 | |
| 15 | static int sandbox_get_info(struct udevice *dev, struct ram_info *info) |
| 16 | { |
| 17 | info->base = 0; |
| 18 | info->size = gd->ram_size; |
| 19 | |
| 20 | return 0; |
| 21 | } |
| 22 | |
| 23 | static const struct ram_ops sandbox_ram_ops = { |
| 24 | .get_info = sandbox_get_info, |
| 25 | }; |
| 26 | |
| 27 | static const struct udevice_id sandbox_ram_ids[] = { |
| 28 | { .compatible = "sandbox,ram" }, |
| 29 | { } |
| 30 | }; |
| 31 | |
| 32 | U_BOOT_DRIVER(warm_ram_sandbox) = { |
| 33 | .name = "ram_sandbox", |
| 34 | .id = UCLASS_RAM, |
| 35 | .of_match = sandbox_ram_ids, |
| 36 | .ops = &sandbox_ram_ops, |
| 37 | }; |