From 6c51df6859fa666d494980f4aa2f19c932898ec1 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 23 Jun 2015 15:39:04 -0600 Subject: dm: Add support for RAM drivers Add support for a driver which sets up DRAM and can return information about the amount of RAM available. This is a first step towards moving RAM init to driver model. Signed-off-by: Simon Glass --- include/dm/uclass-id.h | 1 + include/ram.h | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 include/ram.h (limited to 'include') diff --git a/include/dm/uclass-id.h b/include/dm/uclass-id.h index cba7c0a45eb..93a38575bdf 100644 --- a/include/dm/uclass-id.h +++ b/include/dm/uclass-id.h @@ -28,6 +28,7 @@ enum uclass_id { UCLASS_CPU, /* CPU, typically part of an SoC */ UCLASS_CROS_EC, /* Chrome OS EC */ UCLASS_DISPLAY_PORT, /* Display port video */ + UCLASS_RAM, /* RAM controller */ UCLASS_ETH, /* Ethernet device */ UCLASS_GPIO, /* Bank of general-purpose I/O pins */ UCLASS_I2C, /* I2C bus */ diff --git a/include/ram.h b/include/ram.h new file mode 100644 index 00000000000..e2172a8741c --- /dev/null +++ b/include/ram.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2015 Google, Inc + * Written by Simon Glass + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#ifndef __RAM_H +#define __RAM_H + +struct ram_info { + phys_addr_t base; + size_t size; +}; + +struct ram_ops { + /** + * get_info() - Get basic memory info + * + * @dev: Device to check (UCLASS_RAM) + * @info: Place to put info + * @return 0 if OK, -ve on error + */ + int (*get_info)(struct udevice *dev, struct ram_info *info); +}; + +#define ram_get_ops(dev) ((struct ram_ops *)(dev)->driver->ops) + +/** + * ram_get_info() - Get information about a RAM device + * + * @dev: Device to check (UCLASS_RAM) + * @info: Returns RAM info + * @return 0 if OK, -ve on error + */ +int ram_get_info(struct udevice *dev, struct ram_info *info); + +#endif -- cgit v1.3.1