Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Simon Glass | 3a2f3bd | 2015-06-23 15:39:04 -0600 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (c) 2015 Google, Inc |
| 4 | * Written by Simon Glass <sjg@chromium.org> |
Simon Glass | 3a2f3bd | 2015-06-23 15:39:04 -0600 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #ifndef __RAM_H |
| 8 | #define __RAM_H |
| 9 | |
Tom Rini | dec7ea0 | 2024-05-20 13:35:03 -0600 | [diff] [blame] | 10 | #include <linux/types.h> |
| 11 | |
Simon Glass | 3ba929a | 2020-10-30 21:38:53 -0600 | [diff] [blame] | 12 | struct udevice; |
| 13 | |
Simon Glass | 3a2f3bd | 2015-06-23 15:39:04 -0600 | [diff] [blame] | 14 | struct ram_info { |
| 15 | phys_addr_t base; |
| 16 | size_t size; |
| 17 | }; |
| 18 | |
| 19 | struct ram_ops { |
| 20 | /** |
| 21 | * get_info() - Get basic memory info |
| 22 | * |
| 23 | * @dev: Device to check (UCLASS_RAM) |
| 24 | * @info: Place to put info |
| 25 | * @return 0 if OK, -ve on error |
| 26 | */ |
| 27 | int (*get_info)(struct udevice *dev, struct ram_info *info); |
| 28 | }; |
| 29 | |
| 30 | #define ram_get_ops(dev) ((struct ram_ops *)(dev)->driver->ops) |
| 31 | |
| 32 | /** |
| 33 | * ram_get_info() - Get information about a RAM device |
| 34 | * |
| 35 | * @dev: Device to check (UCLASS_RAM) |
| 36 | * @info: Returns RAM info |
Heinrich Schuchardt | 47b4c02 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 37 | * Return: 0 if OK, -ve on error |
Simon Glass | 3a2f3bd | 2015-06-23 15:39:04 -0600 | [diff] [blame] | 38 | */ |
| 39 | int ram_get_info(struct udevice *dev, struct ram_info *info); |
| 40 | |
| 41 | #endif |