Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Simon Glass | 64ce0ca | 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 | 64ce0ca | 2015-07-06 12:54:31 -0600 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include <common.h> |
| 8 | #include <dm.h> |
| 9 | #include <errno.h> |
| 10 | #include <ram.h> |
Simon Glass | 401d1c4 | 2020-10-30 21:38:53 -0600 | [diff] [blame] | 11 | #include <asm/global_data.h> |
Simon Glass | 64ce0ca | 2015-07-06 12:54:31 -0600 | [diff] [blame] | 12 | #include <asm/test.h> |
| 13 | |
| 14 | DECLARE_GLOBAL_DATA_PTR; |
| 15 | |
| 16 | static 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 | |
| 24 | static const struct ram_ops sandbox_ram_ops = { |
| 25 | .get_info = sandbox_get_info, |
| 26 | }; |
| 27 | |
| 28 | static const struct udevice_id sandbox_ram_ids[] = { |
| 29 | { .compatible = "sandbox,ram" }, |
| 30 | { } |
| 31 | }; |
| 32 | |
| 33 | U_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 | }; |